qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device o


From: John Millikin
Subject: Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
Date: Sat, 20 Aug 2022 11:20:18 +0900

Gentle ping

On Thu, Aug 04, 2022 at 09:29:51PM +0900, John Millikin wrote:
> SunOS expects CD-ROM devices to have a block size of 512, and will
> fail to mount or install using QEMU's default block size of 2048.
> 
> When initializing the SCSI device, allow the `physical_block_size'
> block device option to override the default block size.
> 
> Signed-off-by: John Millikin <john@john-millikin.com>
> ---
>  hw/scsi/scsi-disk.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> This is the same diff as sent to qemu-devel@ about a week ago. That
> first email seems to have been eaten by a grue, but replying to it
> worked, so maybe the grue is gone now.
> 
> See https://gitlab.com/qemu-project/qemu/-/issues/1127 for some
> related discussion about SunOS CD-ROM compatibility.
> 
> diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
> index f5cdb9ad4b..acdf8dc05c 100644
> --- a/hw/scsi/scsi-disk.c
> +++ b/hw/scsi/scsi-disk.c
> @@ -2533,6 +2533,7 @@ static void scsi_cd_realize(SCSIDevice *dev, Error 
> **errp)
>      SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, dev);
>      AioContext *ctx;
>      int ret;
> +    uint32_t blocksize = 2048;
>  
>      if (!dev->conf.blk) {
>          /* Anonymous BlockBackend for an empty drive. As we put it into
> @@ -2542,9 +2543,13 @@ static void scsi_cd_realize(SCSIDevice *dev, Error 
> **errp)
>          assert(ret == 0);
>      }
>  
> +    if (dev->conf.physical_block_size != 0) {
> +        blocksize = dev->conf.physical_block_size;
> +    }
> +
>      ctx = blk_get_aio_context(dev->conf.blk);
>      aio_context_acquire(ctx);
> -    s->qdev.blocksize = 2048;
> +    s->qdev.blocksize = blocksize;
>      s->qdev.type = TYPE_ROM;
>      s->features |= 1 << SCSI_DISK_F_REMOVABLE;
>      if (!s->product) {
> -- 
> 2.25.1
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]