All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
@ 2022-08-04 12:29 John Millikin
  2022-08-20  2:20 ` John Millikin
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: John Millikin @ 2022-08-04 12:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Millikin, Paolo Bonzini, Fam Zheng, Mark Cave-Ayland

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



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-08-04 12:29 [PATCH v2] scsi-disk: support setting CD-ROM block size via device options John Millikin
@ 2022-08-20  2:20 ` John Millikin
  2022-08-20  7:42 ` Paolo Bonzini
  2022-09-30  9:12 ` Paolo Bonzini
  2 siblings, 0 replies; 8+ messages in thread
From: John Millikin @ 2022-08-20  2:20 UTC (permalink / raw)
  To: qemu-devel; +Cc: Paolo Bonzini, Fam Zheng, Mark Cave-Ayland

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
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-08-04 12:29 [PATCH v2] scsi-disk: support setting CD-ROM block size via device options John Millikin
  2022-08-20  2:20 ` John Millikin
@ 2022-08-20  7:42 ` Paolo Bonzini
  2022-09-05  3:30   ` John Millikin
  2022-09-30  9:12 ` Paolo Bonzini
  2 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2022-08-20  7:42 UTC (permalink / raw)
  To: John Millikin; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

[-- Attachment #1: Type: text/plain, Size: 1857 bytes --]

No, I had not seen it indeed. Queued now, thanks.

Paolo

Il gio 4 ago 2022, 14:39 John Millikin <john@john-millikin.com> ha scritto:

> 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
>
>

[-- Attachment #2: Type: text/html, Size: 2660 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-08-20  7:42 ` Paolo Bonzini
@ 2022-09-05  3:30   ` John Millikin
  2022-09-05  7:43     ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: John Millikin @ 2022-09-05  3:30 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

I notice this patch wasn't included in the [PULL] series last week, and
it isn't present in the `master` branch.

Is there anything else I should be doing to get it merged in? Sorry if
this isn't a good question, I'm not used to QEMU's email-based change
management workflow.

On Sat, Aug 20, 2022 at 09:42:25AM +0200, Paolo Bonzini wrote:
> No, I had not seen it indeed. Queued now, thanks.
> 
> Paolo
> 
> Il gio 4 ago 2022, 14:39 John Millikin <john@john-millikin.com> ha scritto:
> 
> > 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
> >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-09-05  3:30   ` John Millikin
@ 2022-09-05  7:43     ` Paolo Bonzini
  2022-09-12  7:54       ` John Millikin
  0 siblings, 1 reply; 8+ messages in thread
From: Paolo Bonzini @ 2022-09-05  7:43 UTC (permalink / raw)
  To: John Millikin; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

[-- Attachment #1: Type: text/plain, Size: 2612 bytes --]

Probably just my screw up, or it broke something when testing... let me
check.

Paolo

Il lun 5 set 2022, 05:30 John Millikin <john@john-millikin.com> ha scritto:

> I notice this patch wasn't included in the [PULL] series last week, and
> it isn't present in the `master` branch.
>
> Is there anything else I should be doing to get it merged in? Sorry if
> this isn't a good question, I'm not used to QEMU's email-based change
> management workflow.
>
> On Sat, Aug 20, 2022 at 09:42:25AM +0200, Paolo Bonzini wrote:
> > No, I had not seen it indeed. Queued now, thanks.
> >
> > Paolo
> >
> > Il gio 4 ago 2022, 14:39 John Millikin <john@john-millikin.com> ha
> scritto:
> >
> > > 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
> > >
> > >
>
>

[-- Attachment #2: Type: text/html, Size: 3832 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-09-05  7:43     ` Paolo Bonzini
@ 2022-09-12  7:54       ` John Millikin
  2022-09-26  2:05         ` John Millikin
  0 siblings, 1 reply; 8+ messages in thread
From: John Millikin @ 2022-09-12  7:54 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

Gentle ping -- is there anything blocking this patch from going in?

It's been about a month now since I sent it, and it's not very big, so I
was hoping it would merge without much difficulty.

If it's breaking a test or something then I'd be happy to take a look
and send a new revision.

On Mon, Sep 05, 2022 at 09:43:20AM +0200, Paolo Bonzini wrote:
> Probably just my screw up, or it broke something when testing... let me
> check.
> 
> Paolo
> 
> Il lun 5 set 2022, 05:30 John Millikin <john@john-millikin.com> ha scritto:
> 
> > I notice this patch wasn't included in the [PULL] series last week, and
> > it isn't present in the `master` branch.
> >
> > Is there anything else I should be doing to get it merged in? Sorry if
> > this isn't a good question, I'm not used to QEMU's email-based change
> > management workflow.
> >
> > On Sat, Aug 20, 2022 at 09:42:25AM +0200, Paolo Bonzini wrote:
> > > No, I had not seen it indeed. Queued now, thanks.
> > >
> > > Paolo
> > >
> > > Il gio 4 ago 2022, 14:39 John Millikin <john@john-millikin.com> ha
> > scritto:
> > >
> > > > 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
> > > >
> > > >
> >
> >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-09-12  7:54       ` John Millikin
@ 2022-09-26  2:05         ` John Millikin
  0 siblings, 0 replies; 8+ messages in thread
From: John Millikin @ 2022-09-26  2:05 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

Gentle ping again.

I'd really like to get this ~6 line patch into mainline so I can pop it
off my TODO list.

On Mon, Sep 12, 2022 at 04:54:52PM +0900, John Millikin wrote:
> Gentle ping -- is there anything blocking this patch from going in?
> 
> It's been about a month now since I sent it, and it's not very big, so I
> was hoping it would merge without much difficulty.
> 
> If it's breaking a test or something then I'd be happy to take a look
> and send a new revision.
> 
> On Mon, Sep 05, 2022 at 09:43:20AM +0200, Paolo Bonzini wrote:
> > Probably just my screw up, or it broke something when testing... let me
> > check.
> > 
> > Paolo
> > 
> > Il lun 5 set 2022, 05:30 John Millikin <john@john-millikin.com> ha scritto:
> > 
> > > I notice this patch wasn't included in the [PULL] series last week, and
> > > it isn't present in the `master` branch.
> > >
> > > Is there anything else I should be doing to get it merged in? Sorry if
> > > this isn't a good question, I'm not used to QEMU's email-based change
> > > management workflow.
> > >
> > > On Sat, Aug 20, 2022 at 09:42:25AM +0200, Paolo Bonzini wrote:
> > > > No, I had not seen it indeed. Queued now, thanks.
> > > >
> > > > Paolo
> > > >


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] scsi-disk: support setting CD-ROM block size via device options
  2022-08-04 12:29 [PATCH v2] scsi-disk: support setting CD-ROM block size via device options John Millikin
  2022-08-20  2:20 ` John Millikin
  2022-08-20  7:42 ` Paolo Bonzini
@ 2022-09-30  9:12 ` Paolo Bonzini
  2 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2022-09-30  9:12 UTC (permalink / raw)
  To: John Millikin; +Cc: qemu-devel, Fam Zheng, Mark Cave-Ayland

Queued, thanks.  Sorry for the delay.

Paolo



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-09-30  9:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-04 12:29 [PATCH v2] scsi-disk: support setting CD-ROM block size via device options John Millikin
2022-08-20  2:20 ` John Millikin
2022-08-20  7:42 ` Paolo Bonzini
2022-09-05  3:30   ` John Millikin
2022-09-05  7:43     ` Paolo Bonzini
2022-09-12  7:54       ` John Millikin
2022-09-26  2:05         ` John Millikin
2022-09-30  9:12 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.