qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] boot: fix path pattern of scsi device


From: Amos Kong
Subject: Re: [Qemu-devel] [PATCH] boot: fix path pattern of scsi device
Date: Tue, 28 May 2013 17:35:01 +0800
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, May 28, 2013 at 10:06:51AM +0200, Paolo Bonzini wrote:
> Il 28/05/2013 09:40, Amos Kong ha scritto:
> > bootindex parameter of scsi device doesn't work, it causes
> > by wrong pattern in seabios.
> > 
> > qemu passes the following firmware dev_path to seabios:
> >  
> > /address@hidden/address@hidden/virtio-scsi-device/address@hidden/address@hidden,0
> 
> No, this is another unexpected change due to the virtio refactoring in
> QEMU.  The right fix is in QEMU, by adding a get_fw_dev_path
> implementation in hw/virtio/virtio-bus.c.

Hi Paolo,

We could not fix this by implementing get_fw_dev_path in
hw/virtio/virtio-bus.c

virtio-bus is the parent bus of scsi-bus, scsibus_get_fw_dev_path()
will be called after called virtio_bus_get_fw_dev_path().

str0 = returns of parents of virtio-bus  /* eg: /address@hidden/address@hidden  
*/
str1 = return of virtio_bus_get_fw_dev_path() /* eg: .. */
str2 = scsibus_get_fw_dev_path() /* eg: address@hidden/address@hidden,0 */

The final fw_dev_path should be $str0/$str1/$str2

| static int qdev_get_fw_dev_path_helper(DeviceState *dev, char *p, int size)
| {
|     int l = 0;
| 
|     if (dev && dev->parent_bus) {
|         char *d;
|         l = qdev_get_fw_dev_path_helper(dev->parent_bus->parent, p, size);
|         d = bus_get_fw_dev_path(dev->parent_bus, dev);
|         if (d) {
|             l += snprintf(p + l, size - l, "%s", d);
|             g_free(d);

if we implement virtio_bus_get_fw_dev_path(), the return value will be set to 
$str1

|         } else {
|             l += snprintf(p + l, size - l, "%s", 
object_get_typename(OBJECT(dev)));

Currently we didn't implement virtio_bus_get_fw_dev_path(), so 
'virtio-scsi-device' was set to $str1

|         }
|  

However, we need to change the pattern.

Amos.

> We fixed it already for migration paths, it should be easy to do the
> same for this.
> 
> Please Cc address@hidden when sending the QEMU patch.
> 
> Thanks,
> 
> Paolo
> 
> > Signed-off-by: Amos Kong <address@hidden>
> > ---
> >  src/boot.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/src/boot.c b/src/boot.c
> > index c308602..cd9d784 100644
> > --- a/src/boot.c
> > +++ b/src/boot.c
> > @@ -138,10 +138,11 @@ int bootprio_find_scsi_device(struct pci_device *pci, 
> > int target, int lun)
> >      if (!pci)
> >          // support only pci machine for now
> >          return -1;
> > -    // Find scsi drive - for example: 
> > /address@hidden/address@hidden/address@hidden/address@hidden,0
> > +    /* Find scsi drive - for example:
> > +       
> > /address@hidden/address@hidden/virtio-scsi-device/address@hidden/address@hidden,0
> >  */
> >      char desc[256], *p;
> >      p = build_pci_path(desc, sizeof(desc), "*", pci);
> > -    snprintf(p, desc+sizeof(desc)-p, "/address@hidden/address@hidden,%d", 
> > target, lun);
> > +    snprintf(p, desc+sizeof(desc)-p, 
> > "/*/address@hidden/address@hidden,%d", target, lun);
> >      return find_prio(desc);
> >  }
> >  
> > 



reply via email to

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