qemu: make default_write_config use mask table
Subsystems (3)
A message that is not in the archive (sent off-list or not yet received): [email protected]
Michael S. Tsirkin
maintainerPATCH v3 1/13 qemu: make default_write_config use mask table
Change much of hw/pci to use symbolic constants and a table-driven
design: add a mask table with writable bits set and readonly bits unset. Detect change by comparing original and new registers.
This makes it easy to support capabilities where read-only/writeable bit layout differs between devices, depending on capabilities present.
As a result, writing a single byte in BAR registers now works as it should. Writing to upper limit registers in the bridge also works as it should. Code is also shorter.
--- hw/pci.c | 145 ++++++++++++------------------------------------------------- hw/pci.h | 18 +++++++- 2 files changed, 46 insertions(+), 117 deletions(-)
hw/pci.c +29 -116
@@ -239,6 +239,17 @@ int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp)return pci_parse_devaddr (devaddr, domp, busp, slotp); } +static void pci_init_mask (PCIDevice *dev) +{ +int i; + dev->wmask[PCI_CACHE_LINE_SIZE ] =0xff ; + dev->wmask[PCI_INTERRUPT_LINE ] =0xff ; + dev->wmask[PCI_COMMAND ] =PCI_COMMAND_IO |PCI_COMMAND_MEMORY + |PCI_COMMAND_MASTER ; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + dev->wmask[i] =0xff ; +} +/* -1 for devfn means auto assign */ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn,
@@ -261,6 +272,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,pstrcpy (pci_dev->name,sizeof (pci_dev->name), name);memset (pci_dev->irq_state,0 ,sizeof (pci_dev->irq_state));pci_set_default_subsystem_id (pci_dev); +pci_init_mask (pci_dev);if (!config_read) config_read = pci_default_read_config;
@@ -334,6 +346,7 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, {PCIIORegion *r;uint32_t addr; +uint32_t wmask;if ((unsigned int )region_num >=PCI_NUM_REGIONS )return ;
@@ -349,12 +362,17 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, r->size = size; r->type = type; r->map_func = map_func; + + wmask = ~(size -1 );if (region_num ==PCI_ROM_SLOT ) { addr =0x30 ; +/* ROM enable bit is writeable */ + wmask |=1 ; }else { addr =0x10 + region_num *4 ; } *(uint32_t *)(pci_dev->config + addr) =cpu_to_le32 (type); + *(uint32_t *)(pci_dev->wmask + addr) =cpu_to_le32 (wmask); }static void pci_update_mappings (PCIDevice *d)
@@ -463,118 +481,21 @@ uint32_t pci_default_read_config(PCIDevice *d,return val; } -void pci_default_write_config (PCIDevice *d, -uint32_t address,uint32_t val,int len) +void pci_default_write_config (PCIDevice *d,uint32_t addr,uint32_t val,int l) { -int can_write, i; -uint32_t end, addr; - -if (len ==4 && ((address >=0x10 && address <0x10 +4 *6 ) || - (address >=0x30 && address <0x34 ))) { -PCIIORegion *r; -int reg; +uint8_t orig[PCI_CONFIG_SPACE_SIZE ]; +int i; -if ( address >=0x30 ) { - reg =PCI_ROM_SLOT ; - }else { - reg = (address -0x10 ) >>2 ; - } - r = &d->io_regions[reg]; -if (r->size ==0 ) - goto default_config; -/* compute the stored value */ -if (reg ==PCI_ROM_SLOT ) { -/* keep ROM enable bit */ - val &= (~(r->size -1 )) |1 ; - }else { - val &= ~(r->size -1 ); - val |= r->type; - } - *(uint32_t *)(d->config + address) =cpu_to_le32 (val); -pci_update_mappings (d); -return ; - } - default_config:/* not efficient, but simple */ - addr = address; -for (i =0 ; i < len; i++) { -/* default read/write accesses */ -switch (d->config[0x0e ]) { -case 0x00 : -case 0x80 : -switch (addr) { -case 0x00 : -case 0x01 : -case 0x02 : -case 0x03 : -case 0x06 : -case 0x07 : -case 0x08 : -case 0x09 : -case 0x0a : -case 0x0b : -case 0x0e : - case 0x10 ... 0x27: /* base */ - case 0x2c ... 0x2f: /* read-only subsystem ID & vendor ID */ - case 0x30 ... 0x33: /* rom */ -case 0x3d : - can_write =0 ; -break ; -default : - can_write =1 ; -break ; - } -break ; -default : -case 0x01 : -switch (addr) { -case 0x00 : -case 0x01 : -case 0x02 : -case 0x03 : -case 0x06 : -case 0x07 : -case 0x08 : -case 0x09 : -case 0x0a : -case 0x0b : -case 0x0e : - case 0x2c ... 0x2f: /* read-only subsystem ID & vendor ID */ - case 0x38 ... 0x3b: /* rom */ -case 0x3d : - can_write =0 ; -break ; -default : - can_write =1 ; -break ; - } -break ; - } -if (can_write) { -/* Mask out writes to reserved bits in registers */ -switch (addr) { -case 0x05 : - val &= ~PCI_COMMAND_RESERVED_MASK_HI ; -break ; -case 0x06 : - val &= ~PCI_STATUS_RESERVED_MASK_LO ; -break ; -case 0x07 : - val &= ~PCI_STATUS_RESERVED_MASK_HI ; -break ; - } - d->config[addr] = val; - } -if (++addr >0xff ) -break ; - val >>=8 ; +memcpy (orig, d->config,PCI_CONFIG_SPACE_SIZE ); +for (i =0 ; i < l && addr <PCI_CONFIG_SPACE_SIZE ; val >>=8 , ++i, ++addr) { +uint8_t wmask = d->wmask[addr]; + d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask); } - - end = address + len; -if (end >PCI_COMMAND && address < (PCI_COMMAND +2 )) { -/* if the command register is modified, we must modify the mappings */ +if (memcmp (orig +PCI_BASE_ADDRESS_0 , d->config +PCI_BASE_ADDRESS_0 ,24 ) + || ((orig[PCI_COMMAND ] ^ d->config[PCI_COMMAND ]) + & (PCI_COMMAND_MEMORY |PCI_COMMAND_IO )))pci_update_mappings (d); - } }void pci_data_write (void *opaque,uint32_t addr,uint32_t val,int len)
@@ -847,16 +768,8 @@ static void pci_bridge_write_config(PCIDevice *d, {PCIBridge *s = (PCIBridge *)d; -if (address ==0x19 || (address ==0x18 && len >1 )) { -if (address ==0x19 ) - s->bus->bus_num = val &0xff ; -else - s->bus->bus_num = (val >>8 ) &0xff ; -#if defined(DEBUG_PCI ) -printf ("pci-bridge: %s: Assigned bus %d\n" , d->name, s->bus->bus_num); -#endif - }pci_default_write_config (d, address, val, len); + s->bus->bus_num = d->config[PCI_SECONDARY_BUS ]; }PCIBus *pci_find_bus (int bus_num)
hw/pci.h +17 -1
@@ -100,16 +100,24 @@ typedef struct PCIIORegion {#define PCI_COMMAND 0x04/* 16 bits */ #define PCI_COMMAND_IO 0x1/* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2/* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x4/* Enable bus master */ #define PCI_STATUS 0x06/* 16 bits */ #define PCI_REVISION_ID 0x08/* 8 bits */ #define PCI_CLASS_DEVICE 0x0a/* Device class */ +#define PCI_CACHE_LINE_SIZE 0x0c/* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d/* 8 bits */ #define PCI_HEADER_TYPE 0x0e/* 8 bits */ #define PCI_HEADER_TYPE_NORMAL 0#define PCI_HEADER_TYPE_BRIDGE 1#define PCI_HEADER_TYPE_CARDBUS 2#define PCI_HEADER_TYPE_MULTI_FUNCTION 0x80 +#define PCI_BASE_ADDRESS_0 0x10/* 32 bits */ +#define PCI_PRIMARY_BUS 0x18/* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19/* Secondary bus number */ +#define PCI_SEC_STATUS 0x1e/* Secondary status register, only bit 14 used */ #define PCI_SUBSYSTEM_VENDOR_ID 0x2c/* 16 bits */ #define PCI_SUBSYSTEM_ID 0x2e/* 16 bits */ +#define PCI_CAPABILITY_LIST 0x34/* Offset of first capability list entry */ #define PCI_INTERRUPT_LINE 0x3c/* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d/* 8 bits */ #define PCI_MIN_GNT 0x3e/* 8 bits */
@@ -139,10 +147,18 @@ typedef struct PCIIORegion {#define PCI_COMMAND_RESERVED_MASK_HI (PCI_COMMAND_RESERVED >> 8) +/* Size of the standard PCI config header */ +#define PCI_CONFIG_HEADER_SIZE 0x40 +/* Size of the standard PCI config space */ +#define PCI_CONFIG_SPACE_SIZE 0x100 +struct PCIDevice {DeviceState qdev;/* PCI config space */ -uint8_t config[256 ]; +uint8_t config[PCI_CONFIG_SPACE_SIZE ]; + +/* Used to implement R/W bytes */ +uint8_t wmask[PCI_CONFIG_SPACE_SIZE ];/* the following fields are read only */ PCIBus *bus;
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerPATCH v3 1/13 qemu: make default_write_config use mask table
In reply to a message not in the archiveChange much of hw/pci to use symbolic constants and a table-driven
design: add a mask table with writable bits set and readonly bits unset. Detect change by comparing original and new registers.
This makes it easy to support capabilities where read-only/writeable bit layout differs between devices, depending on capabilities present.
As a result, writing a single byte in BAR registers now works as it should. Writing to upper limit registers in the bridge also works as it should. Code is also shorter.
--- hw/pci.c | 145 ++++++++++++------------------------------------------------- hw/pci.h | 18 +++++++- 2 files changed, 46 insertions(+), 117 deletions(-)
hw/pci.c +29 -116
@@ -239,6 +239,17 @@ int pci_assign_devaddr(const char *addr, int *domp, int *busp, unsigned *slotp)return pci_parse_devaddr (devaddr, domp, busp, slotp); } +static void pci_init_mask (PCIDevice *dev) +{ +int i; + dev->wmask[PCI_CACHE_LINE_SIZE ] =0xff ; + dev->wmask[PCI_INTERRUPT_LINE ] =0xff ; + dev->wmask[PCI_COMMAND ] =PCI_COMMAND_IO |PCI_COMMAND_MEMORY + |PCI_COMMAND_MASTER ; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + dev->wmask[i] =0xff ; +} +/* -1 for devfn means auto assign */ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus, const char *name, int devfn,
@@ -261,6 +272,7 @@ static PCIDevice *do_pci_register_device(PCIDevice *pci_dev, PCIBus *bus,pstrcpy (pci_dev->name,sizeof (pci_dev->name), name);memset (pci_dev->irq_state,0 ,sizeof (pci_dev->irq_state));pci_set_default_subsystem_id (pci_dev); +pci_init_mask (pci_dev);if (!config_read) config_read = pci_default_read_config;
@@ -334,6 +346,7 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, {PCIIORegion *r;uint32_t addr; +uint32_t wmask;if ((unsigned int )region_num >=PCI_NUM_REGIONS )return ;
@@ -349,12 +362,17 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, r->size = size; r->type = type; r->map_func = map_func; + + wmask = ~(size -1 );if (region_num ==PCI_ROM_SLOT ) { addr =0x30 ; +/* ROM enable bit is writeable */ + wmask |=1 ; }else { addr =0x10 + region_num *4 ; } *(uint32_t *)(pci_dev->config + addr) =cpu_to_le32 (type); + *(uint32_t *)(pci_dev->wmask + addr) =cpu_to_le32 (wmask); }static void pci_update_mappings (PCIDevice *d)
@@ -463,118 +481,21 @@ uint32_t pci_default_read_config(PCIDevice *d,return val; } -void pci_default_write_config (PCIDevice *d, -uint32_t address,uint32_t val,int len) +void pci_default_write_config (PCIDevice *d,uint32_t addr,uint32_t val,int l) { -int can_write, i; -uint32_t end, addr; - -if (len ==4 && ((address >=0x10 && address <0x10 +4 *6 ) || - (address >=0x30 && address <0x34 ))) { -PCIIORegion *r; -int reg; +uint8_t orig[PCI_CONFIG_SPACE_SIZE ]; +int i; -if ( address >=0x30 ) { - reg =PCI_ROM_SLOT ; - }else { - reg = (address -0x10 ) >>2 ; - } - r = &d->io_regions[reg]; -if (r->size ==0 ) - goto default_config; -/* compute the stored value */ -if (reg ==PCI_ROM_SLOT ) { -/* keep ROM enable bit */ - val &= (~(r->size -1 )) |1 ; - }else { - val &= ~(r->size -1 ); - val |= r->type; - } - *(uint32_t *)(d->config + address) =cpu_to_le32 (val); -pci_update_mappings (d); -return ; - } - default_config:/* not efficient, but simple */ - addr = address; -for (i =0 ; i < len; i++) { -/* default read/write accesses */ -switch (d->config[0x0e ]) { -case 0x00 : -case 0x80 : -switch (addr) { -case 0x00 : -case 0x01 : -case 0x02 : -case 0x03 : -case 0x06 : -case 0x07 : -case 0x08 : -case 0x09 : -case 0x0a : -case 0x0b : -case 0x0e : - case 0x10 ... 0x27: /* base */ - case 0x2c ... 0x2f: /* read-only subsystem ID & vendor ID */ - case 0x30 ... 0x33: /* rom */ -case 0x3d : - can_write =0 ; -break ; -default : - can_write =1 ; -break ; - } -break ; -default : -case 0x01 : -switch (addr) { -case 0x00 : -case 0x01 : -case 0x02 : -case 0x03 : -case 0x06 : -case 0x07 : -case 0x08 : -case 0x09 : -case 0x0a : -case 0x0b : -case 0x0e : - case 0x2c ... 0x2f: /* read-only subsystem ID & vendor ID */ - case 0x38 ... 0x3b: /* rom */ -case 0x3d : - can_write =0 ; -break ; -default : - can_write =1 ; -break ; - } -break ; - } -if (can_write) { -/* Mask out writes to reserved bits in registers */ -switch (addr) { -case 0x05 : - val &= ~PCI_COMMAND_RESERVED_MASK_HI ; -break ; -case 0x06 : - val &= ~PCI_STATUS_RESERVED_MASK_LO ; -break ; -case 0x07 : - val &= ~PCI_STATUS_RESERVED_MASK_HI ; -break ; - } - d->config[addr] = val; - } -if (++addr >0xff ) -break ; - val >>=8 ; +memcpy (orig, d->config,PCI_CONFIG_SPACE_SIZE ); +for (i =0 ; i < l && addr <PCI_CONFIG_SPACE_SIZE ; val >>=8 , ++i, ++addr) { +uint8_t wmask = d->wmask[addr]; + d->config[addr] = (d->config[addr] & ~wmask) | (val & wmask); } - - end = address + len; -if (end >PCI_COMMAND && address < (PCI_COMMAND +2 )) { -/* if the command register is modified, we must modify the mappings */ +if (memcmp (orig +PCI_BASE_ADDRESS_0 , d->config +PCI_BASE_ADDRESS_0 ,24 ) + || ((orig[PCI_COMMAND ] ^ d->config[PCI_COMMAND ]) + & (PCI_COMMAND_MEMORY |PCI_COMMAND_IO )))pci_update_mappings (d); - } }void pci_data_write (void *opaque,uint32_t addr,uint32_t val,int len)
@@ -847,16 +768,8 @@ static void pci_bridge_write_config(PCIDevice *d, {PCIBridge *s = (PCIBridge *)d; -if (address ==0x19 || (address ==0x18 && len >1 )) { -if (address ==0x19 ) - s->bus->bus_num = val &0xff ; -else - s->bus->bus_num = (val >>8 ) &0xff ; -#if defined(DEBUG_PCI ) -printf ("pci-bridge: %s: Assigned bus %d\n" , d->name, s->bus->bus_num); -#endif - }pci_default_write_config (d, address, val, len); + s->bus->bus_num = d->config[PCI_SECONDARY_BUS ]; }PCIBus *pci_find_bus (int bus_num)
hw/pci.h +17 -1
@@ -100,16 +100,24 @@ typedef struct PCIIORegion {#define PCI_COMMAND 0x04/* 16 bits */ #define PCI_COMMAND_IO 0x1/* Enable response in I/O space */ #define PCI_COMMAND_MEMORY 0x2/* Enable response in Memory space */ +#define PCI_COMMAND_MASTER 0x4/* Enable bus master */ #define PCI_STATUS 0x06/* 16 bits */ #define PCI_REVISION_ID 0x08/* 8 bits */ #define PCI_CLASS_DEVICE 0x0a/* Device class */ +#define PCI_CACHE_LINE_SIZE 0x0c/* 8 bits */ +#define PCI_LATENCY_TIMER 0x0d/* 8 bits */ #define PCI_HEADER_TYPE 0x0e/* 8 bits */ #define PCI_HEADER_TYPE_NORMAL 0#define PCI_HEADER_TYPE_BRIDGE 1#define PCI_HEADER_TYPE_CARDBUS 2#define PCI_HEADER_TYPE_MULTI_FUNCTION 0x80 +#define PCI_BASE_ADDRESS_0 0x10/* 32 bits */ +#define PCI_PRIMARY_BUS 0x18/* Primary bus number */ +#define PCI_SECONDARY_BUS 0x19/* Secondary bus number */ +#define PCI_SEC_STATUS 0x1e/* Secondary status register, only bit 14 used */ #define PCI_SUBSYSTEM_VENDOR_ID 0x2c/* 16 bits */ #define PCI_SUBSYSTEM_ID 0x2e/* 16 bits */ +#define PCI_CAPABILITY_LIST 0x34/* Offset of first capability list entry */ #define PCI_INTERRUPT_LINE 0x3c/* 8 bits */ #define PCI_INTERRUPT_PIN 0x3d/* 8 bits */ #define PCI_MIN_GNT 0x3e/* 8 bits */
@@ -139,10 +147,18 @@ typedef struct PCIIORegion {#define PCI_COMMAND_RESERVED_MASK_HI (PCI_COMMAND_RESERVED >> 8) +/* Size of the standard PCI config header */ +#define PCI_CONFIG_HEADER_SIZE 0x40 +/* Size of the standard PCI config space */ +#define PCI_CONFIG_SPACE_SIZE 0x100 +struct PCIDevice {DeviceState qdev;/* PCI config space */ -uint8_t config[256 ]; +uint8_t config[PCI_CONFIG_SPACE_SIZE ]; + +/* Used to implement R/W bytes */ +uint8_t wmask[PCI_CONFIG_SPACE_SIZE ];/* the following fields are read only */ PCIBus *bus;
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerPATCH v3 2/13 qemu: capability bits in pci save/restore
In reply to a message not in the archiveAdd support for capability bits in save/restore for pci. These will be used for MSI, where the capability might be present or not as requested by user, which does not map well into a single version number.
--- hw/pci.c | 14 ++++++++++++-- hw/pci.h | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-)
hw/pci.c +12 -2
@@ -127,12 +127,15 @@ int pci_bus_num(PCIBus *s)void pci_device_save (PCIDevice *s,QEMUFile *f) { +int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f,2 );/* PCI device version */ +qemu_put_be32 (f, version);/* PCI device version */ qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present); }int pci_device_load (PCIDevice *s,QEMUFile *f)
@@ -141,7 +144,7 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)int i; version_id =qemu_get_be32 (f); -if (version_id >2 ) +if (version_id >3 )return -EINVAL ;qemu_get_buffer (f, s->config,256 );pci_update_mappings (s);
@@ -149,6 +152,13 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (version_id >=2 )for (i =0 ; i <4 ; i ++) s->irq_state[i] =qemu_get_be32 (f); +if (version_id >=3 ) + s->cap_present =qemu_get_be32 (f); +else + s->cap_present =0 ; + +if (s->cap_present & ~s->cap_supported) +return -EINVAL ;return 0 ; }
hw/pci.h +4 -0
@@ -178,6 +178,10 @@ struct PCIDevice {/* Current IRQ levels. Used internally by the generic PCI code. */ int irq_state[4 ]; + +/* Capability bits for save/load */ +uint32_t cap_supported; +uint32_t cap_present; }; PCIDevice *pci_register_device(PCIBus *bus, const char *name,
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerPATCH v3 2/13 qemu: capability bits in pci save/restore
In reply to a message not in the archiveAdd support for capability bits in save/restore for pci. These will be used for MSI, where the capability might be present or not as requested by user, which does not map well into a single version number.
--- hw/pci.c | 14 ++++++++++++-- hw/pci.h | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-)
hw/pci.c +12 -2
@@ -127,12 +127,15 @@ int pci_bus_num(PCIBus *s)void pci_device_save (PCIDevice *s,QEMUFile *f) { +int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f,2 );/* PCI device version */ +qemu_put_be32 (f, version);/* PCI device version */ qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present); }int pci_device_load (PCIDevice *s,QEMUFile *f)
@@ -141,7 +144,7 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)int i; version_id =qemu_get_be32 (f); -if (version_id >2 ) +if (version_id >3 )return -EINVAL ;qemu_get_buffer (f, s->config,256 );pci_update_mappings (s);
@@ -149,6 +152,13 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (version_id >=2 )for (i =0 ; i <4 ; i ++) s->irq_state[i] =qemu_get_be32 (f); +if (version_id >=3 ) + s->cap_present =qemu_get_be32 (f); +else + s->cap_present =0 ; + +if (s->cap_present & ~s->cap_supported) +return -EINVAL ;return 0 ; }
hw/pci.h +4 -0
@@ -178,6 +178,10 @@ struct PCIDevice {/* Current IRQ levels. Used internally by the generic PCI code. */ int irq_state[4 ]; + +/* Capability bits for save/load */ +uint32_t cap_supported; +uint32_t cap_present; }; PCIDevice *pci_register_device(PCIBus *bus, const char *name,
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerPATCH v3 3/13 qemu: add routines to manage PCI capabilities
In reply to a message not in the archiveAdd routines to manage PCI capability list. First user will be MSI-X.
--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)
hw/pci.c +89 -9
@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ +/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }int pci_device_load (PCIDevice *s,QEMUFile *f)
@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else
@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ; +qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 ) +for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }
@@ -870,3 +877,76 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)return (PCIDevice *)dev; } + +static int pci_find_space (PCIDevice *pdev,uint8_t size) +{ +int offset =PCI_CONFIG_HEADER_SIZE ; +int i; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) +if (pdev->used[i]) + offset = i +1 ; +else if (i - offset +1 == size) +return offset; +return 0 ; +} + +static uint8_t pci_find_capability_list (PCIDevice *pdev,uint8_t cap_id, +uint8_t *prev_p) +{ +uint8_t next, prev; + +if (!(pdev->config[PCI_STATUS ] &PCI_STATUS_CAP_LIST )) +return 0 ; + +for (prev =PCI_CAPABILITY_LIST ; (next = pdev->config[prev]); + prev = next +PCI_CAP_LIST_NEXT ) +if (pdev->config[next +PCI_CAP_LIST_ID ] == cap_id) +break ; + + *prev_p = prev; +return next; +} + +/* Reserve space and add capability to the linked list in pci config space */ +int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t offset =pci_find_space (pdev, size); +uint8_t *config = pdev->config + offset; +if (!offset) +return -ENOSPC ; + config[PCI_CAP_LIST_ID ] = cap_id; + config[PCI_CAP_LIST_NEXT ] = pdev->config[PCI_CAPABILITY_LIST ]; + pdev->config[PCI_CAPABILITY_LIST ] = offset; + pdev->config[PCI_STATUS ] |=PCI_STATUS_CAP_LIST ; +memset (pdev->used + offset,0xFF , size); +/* Make capability read-only by default */ +memset (pdev->wmask + offset,0 , size); +return offset; +} + +/* Unlink capability from the pci config space. */ +void pci_del_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t prev, offset =pci_find_capability_list (pdev, cap_id, &prev); +if (!offset) +return ; + pdev->config[prev] = pdev->config[offset +PCI_CAP_LIST_NEXT ]; +/* Make capability writeable again */ +memset (pdev->wmask + offset,0xff , size); +memset (pdev->used + offset,0 , size); + +if (!pdev->config[PCI_CAPABILITY_LIST ]) + pdev->config[PCI_STATUS ] &= ~PCI_STATUS_CAP_LIST ; +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability (PCIDevice *pdev,uint8_t offset,uint8_t size) +{ +memset (pdev->used + offset,0xff , size); +} + +uint8_t pci_find_capability (PCIDevice *pdev,uint8_t cap_id) +{ +uint8_t prev; +return pci_find_capability_list (pdev, cap_id, &prev); +}
hw/pci.h +17 -1
@@ -123,6 +123,10 @@ typedef struct PCIIORegion {#define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0/* Capability ID */ +#define PCI_CAP_LIST_NEXT 1/* Next capability in the list */ +#define PCI_REVISION 0x08/* obsolete, use PCI_REVISION_ID */ #define PCI_SUBVENDOR_ID 0x2c/* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */ #define PCI_SUBDEVICE_ID 0x2e/* obsolete, use PCI_SUBSYSTEM_ID */
@@ -130,7 +134,7 @@ typedef struct PCIIORegion {/* Bits in the PCI Status Register (PCI 2.3 spec) */ #define PCI_STATUS_RESERVED1 0x007#define PCI_STATUS_INT_STATUS 0x008 -#define PCI_STATUS_CAPABILITIES 0x010 +#define PCI_STATUS_CAP_LIST 0x010#define PCI_STATUS_66MHZ 0x020#define PCI_STATUS_RESERVED2 0x040#define PCI_STATUS_FAST_BACK 0x080
@@ -160,6 +164,9 @@ struct PCIDevice {/* Used to implement R/W bytes */ uint8_t wmask[PCI_CONFIG_SPACE_SIZE ]; +/* Used to allocate config space for capabilities. */ +uint8_t used[PCI_CONFIG_SPACE_SIZE ]; +/* the following fields are read only */ PCIBus *bus;int devfn;
@@ -194,6 +201,15 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_reserve_capability (PCIDevice *pci_dev,uint8_t offset,uint8_t size); + +uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id); + +uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len); void pci_default_write_config(PCIDevice *d,
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerPATCH v3 3/13 qemu: add routines to manage PCI capabilities
In reply to a message not in the archiveAdd routines to manage PCI capability list. First user will be MSI-X.
--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)
hw/pci.c +89 -9
@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ +/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }int pci_device_load (PCIDevice *s,QEMUFile *f)
@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else
@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ; +qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 ) +for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }
@@ -870,3 +877,76 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)return (PCIDevice *)dev; } + +static int pci_find_space (PCIDevice *pdev,uint8_t size) +{ +int offset =PCI_CONFIG_HEADER_SIZE ; +int i; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) +if (pdev->used[i]) + offset = i +1 ; +else if (i - offset +1 == size) +return offset; +return 0 ; +} + +static uint8_t pci_find_capability_list (PCIDevice *pdev,uint8_t cap_id, +uint8_t *prev_p) +{ +uint8_t next, prev; + +if (!(pdev->config[PCI_STATUS ] &PCI_STATUS_CAP_LIST )) +return 0 ; + +for (prev =PCI_CAPABILITY_LIST ; (next = pdev->config[prev]); + prev = next +PCI_CAP_LIST_NEXT ) +if (pdev->config[next +PCI_CAP_LIST_ID ] == cap_id) +break ; + + *prev_p = prev; +return next; +} + +/* Reserve space and add capability to the linked list in pci config space */ +int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t offset =pci_find_space (pdev, size); +uint8_t *config = pdev->config + offset; +if (!offset) +return -ENOSPC ; + config[PCI_CAP_LIST_ID ] = cap_id; + config[PCI_CAP_LIST_NEXT ] = pdev->config[PCI_CAPABILITY_LIST ]; + pdev->config[PCI_CAPABILITY_LIST ] = offset; + pdev->config[PCI_STATUS ] |=PCI_STATUS_CAP_LIST ; +memset (pdev->used + offset,0xFF , size); +/* Make capability read-only by default */ +memset (pdev->wmask + offset,0 , size); +return offset; +} + +/* Unlink capability from the pci config space. */ +void pci_del_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t prev, offset =pci_find_capability_list (pdev, cap_id, &prev); +if (!offset) +return ; + pdev->config[prev] = pdev->config[offset +PCI_CAP_LIST_NEXT ]; +/* Make capability writeable again */ +memset (pdev->wmask + offset,0xff , size); +memset (pdev->used + offset,0 , size); + +if (!pdev->config[PCI_CAPABILITY_LIST ]) + pdev->config[PCI_STATUS ] &= ~PCI_STATUS_CAP_LIST ; +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability (PCIDevice *pdev,uint8_t offset,uint8_t size) +{ +memset (pdev->used + offset,0xff , size); +} + +uint8_t pci_find_capability (PCIDevice *pdev,uint8_t cap_id) +{ +uint8_t prev; +return pci_find_capability_list (pdev, cap_id, &prev); +}
hw/pci.h +17 -1
@@ -123,6 +123,10 @@ typedef struct PCIIORegion {#define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0/* Capability ID */ +#define PCI_CAP_LIST_NEXT 1/* Next capability in the list */ +#define PCI_REVISION 0x08/* obsolete, use PCI_REVISION_ID */ #define PCI_SUBVENDOR_ID 0x2c/* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */ #define PCI_SUBDEVICE_ID 0x2e/* obsolete, use PCI_SUBSYSTEM_ID */
@@ -130,7 +134,7 @@ typedef struct PCIIORegion {/* Bits in the PCI Status Register (PCI 2.3 spec) */ #define PCI_STATUS_RESERVED1 0x007#define PCI_STATUS_INT_STATUS 0x008 -#define PCI_STATUS_CAPABILITIES 0x010 +#define PCI_STATUS_CAP_LIST 0x010#define PCI_STATUS_66MHZ 0x020#define PCI_STATUS_RESERVED2 0x040#define PCI_STATUS_FAST_BACK 0x080
@@ -160,6 +164,9 @@ struct PCIDevice {/* Used to implement R/W bytes */ uint8_t wmask[PCI_CONFIG_SPACE_SIZE ]; +/* Used to allocate config space for capabilities. */ +uint8_t used[PCI_CONFIG_SPACE_SIZE ]; +/* the following fields are read only */ PCIBus *bus;int devfn;
@@ -194,6 +201,15 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_reserve_capability (PCIDevice *pci_dev,uint8_t offset,uint8_t size); + +uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id); + +uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len); void pci_default_write_config(PCIDevice *d,
Signature · 1 line
1.6.3.1.56.g79e1.dirty
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */
hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }
What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.
Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )
hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else
ditto.
Quoted 8 lines
hw/pci.c +4
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ; +qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )
hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }
Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
Quoted 24 lines
hw/pci.c +19
-0@@ -870,3 +877,76 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)return (PCIDevice *)dev; } + +static int pci_find_space (PCIDevice *pdev,uint8_t size) +{ +int offset =PCI_CONFIG_HEADER_SIZE ; +int i; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) +if (pdev->used[i]) + offset = i +1 ; +else if (i - offset +1 == size) +return offset; +return 0 ; +} + +static uint8_t pci_find_capability_list (PCIDevice *pdev,uint8_t cap_id, +uint8_t *prev_p) +{ +uint8_t next, prev; + +if (!(pdev->config[PCI_STATUS ] &PCI_STATUS_CAP_LIST ))
hw/pci.c PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) · line 908
Quoted 10 lines
hw/pci.c +10
-0+return 0 ; + +for (prev =PCI_CAPABILITY_LIST ; (next = pdev->config[prev]); + prev = next +PCI_CAP_LIST_NEXT ) +if (pdev->config[next +PCI_CAP_LIST_ID ] == cap_id) +break ; + + *prev_p = prev; +return next; +}
I'd prefer to do:
if (prev_p) *prev_p = prev;
so we don't have to always pass a prev_p pointer. You have yourself a user where you don't need it in this very patch.
Quoted 99 lines
hw/pci.c +44
-0+ +/* Reserve space and add capability to the linked list in pci config space */ +int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t offset =pci_find_space (pdev, size); +uint8_t *config = pdev->config + offset; +if (!offset) +return -ENOSPC ; + config[PCI_CAP_LIST_ID ] = cap_id; + config[PCI_CAP_LIST_NEXT ] = pdev->config[PCI_CAPABILITY_LIST ]; + pdev->config[PCI_CAPABILITY_LIST ] = offset; + pdev->config[PCI_STATUS ] |=PCI_STATUS_CAP_LIST ; +memset (pdev->used + offset,0xFF , size); +/* Make capability read-only by default */ +memset (pdev->wmask + offset,0 , size); +return offset; +} + +/* Unlink capability from the pci config space. */ +void pci_del_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t prev, offset =pci_find_capability_list (pdev, cap_id, &prev); +if (!offset) +return ; + pdev->config[prev] = pdev->config[offset +PCI_CAP_LIST_NEXT ]; +/* Make capability writeable again */ +memset (pdev->wmask + offset,0xff , size); +memset (pdev->used + offset,0 , size); + +if (!pdev->config[PCI_CAPABILITY_LIST ]) + pdev->config[PCI_STATUS ] &= ~PCI_STATUS_CAP_LIST ; +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability (PCIDevice *pdev,uint8_t offset,uint8_t size) +{ +memset (pdev->used + offset,0xff , size); +} + +uint8_t pci_find_capability (PCIDevice *pdev,uint8_t cap_id) +{ +uint8_t prev; +return pci_find_capability_list (pdev, cap_id, &prev); +}hw/pci.h +17
-1@@ -123,6 +123,10 @@ typedef struct PCIIORegion {#define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0/* Capability ID */ +#define PCI_CAP_LIST_NEXT 1/* Next capability in the list */ +#define PCI_REVISION 0x08/* obsolete, use PCI_REVISION_ID */ #define PCI_SUBVENDOR_ID 0x2c/* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */ #define PCI_SUBDEVICE_ID 0x2e/* obsolete, use PCI_SUBSYSTEM_ID */ @@ -130,7 +134,7 @@ typedef struct PCIIORegion {/* Bits in the PCI Status Register (PCI 2.3 spec) */ #define PCI_STATUS_RESERVED1 0x007#define PCI_STATUS_INT_STATUS 0x008 -#define PCI_STATUS_CAPABILITIES 0x010 +#define PCI_STATUS_CAP_LIST 0x010#define PCI_STATUS_66MHZ 0x020#define PCI_STATUS_RESERVED2 0x040#define PCI_STATUS_FAST_BACK 0x080@@ -160,6 +164,9 @@ struct PCIDevice {/* Used to implement R/W bytes */ uint8_t wmask[PCI_CONFIG_SPACE_SIZE ]; +/* Used to allocate config space for capabilities. */ +uint8_t used[PCI_CONFIG_SPACE_SIZE ]; +/* the following fields are read only */ PCIBus *bus;int devfn;@@ -194,6 +201,15 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_reserve_capability (PCIDevice *pci_dev,uint8_t offset,uint8_t size); + +uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id); + +uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len); void pci_default_write_config(PCIDevice *d,Signature · 1 line
1.6.3.1.56.g79e1.dirty
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 52 lines · Glauber Costa
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else ditto.
Quoted 4 lines
hw/pci.c +0
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ;
Quoted 16 lines
Quoted 4 lines
hw/pci.c +4
-0+qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
We lose the ability to let user control the capabilities exposed by the device.
And generally, I dislike arbitrary limitations. The PCI spec says the capability can be anywhere, implementing a linked list of caps is simple enough to not invent abritrary restrictions.
Quoted 35 lines
Quoted 24 lines
hw/pci.c +19
-0@@ -870,3 +877,76 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)return (PCIDevice *)dev; } + +static int pci_find_space (PCIDevice *pdev,uint8_t size) +{ +int offset =PCI_CONFIG_HEADER_SIZE ; +int i; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) +if (pdev->used[i]) + offset = i +1 ; +else if (i - offset +1 == size) +return offset; +return 0 ; +} + +static uint8_t pci_find_capability_list (PCIDevice *pdev,uint8_t cap_id, +uint8_t *prev_p) +{ +uint8_t next, prev; + +if (!(pdev->config[PCI_STATUS ] &PCI_STATUS_CAP_LIST ))hw/pci.c PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) · line 908
Quoted 10 lines
hw/pci.c +10
-0+return 0 ; + +for (prev =PCI_CAPABILITY_LIST ; (next = pdev->config[prev]); + prev = next +PCI_CAP_LIST_NEXT ) +if (pdev->config[next +PCI_CAP_LIST_ID ] == cap_id) +break ; + + *prev_p = prev; +return next; +}I'd prefer to do:
Quoted 4 lines
if (prev_p) *prev_p = prev;so we don't have to always pass a
prev_ppointer. You have yourself a user where you don't need it in this very patch.
Good idea.
Quoted 99 lines
Quoted 99 lines
hw/pci.c +44
-0+ +/* Reserve space and add capability to the linked list in pci config space */ +int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t offset =pci_find_space (pdev, size); +uint8_t *config = pdev->config + offset; +if (!offset) +return -ENOSPC ; + config[PCI_CAP_LIST_ID ] = cap_id; + config[PCI_CAP_LIST_NEXT ] = pdev->config[PCI_CAPABILITY_LIST ]; + pdev->config[PCI_CAPABILITY_LIST ] = offset; + pdev->config[PCI_STATUS ] |=PCI_STATUS_CAP_LIST ; +memset (pdev->used + offset,0xFF , size); +/* Make capability read-only by default */ +memset (pdev->wmask + offset,0 , size); +return offset; +} + +/* Unlink capability from the pci config space. */ +void pci_del_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t prev, offset =pci_find_capability_list (pdev, cap_id, &prev); +if (!offset) +return ; + pdev->config[prev] = pdev->config[offset +PCI_CAP_LIST_NEXT ]; +/* Make capability writeable again */ +memset (pdev->wmask + offset,0xff , size); +memset (pdev->used + offset,0 , size); + +if (!pdev->config[PCI_CAPABILITY_LIST ]) + pdev->config[PCI_STATUS ] &= ~PCI_STATUS_CAP_LIST ; +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability (PCIDevice *pdev,uint8_t offset,uint8_t size) +{ +memset (pdev->used + offset,0xff , size); +} + +uint8_t pci_find_capability (PCIDevice *pdev,uint8_t cap_id) +{ +uint8_t prev; +return pci_find_capability_list (pdev, cap_id, &prev); +}hw/pci.h +17
-1@@ -123,6 +123,10 @@ typedef struct PCIIORegion {#define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0/* Capability ID */ +#define PCI_CAP_LIST_NEXT 1/* Next capability in the list */ +#define PCI_REVISION 0x08/* obsolete, use PCI_REVISION_ID */ #define PCI_SUBVENDOR_ID 0x2c/* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */ #define PCI_SUBDEVICE_ID 0x2e/* obsolete, use PCI_SUBSYSTEM_ID */ @@ -130,7 +134,7 @@ typedef struct PCIIORegion {/* Bits in the PCI Status Register (PCI 2.3 spec) */ #define PCI_STATUS_RESERVED1 0x007#define PCI_STATUS_INT_STATUS 0x008 -#define PCI_STATUS_CAPABILITIES 0x010 +#define PCI_STATUS_CAP_LIST 0x010#define PCI_STATUS_66MHZ 0x020#define PCI_STATUS_RESERVED2 0x040#define PCI_STATUS_FAST_BACK 0x080@@ -160,6 +164,9 @@ struct PCIDevice {/* Used to implement R/W bytes */ uint8_t wmask[PCI_CONFIG_SPACE_SIZE ]; +/* Used to allocate config space for capabilities. */ +uint8_t used[PCI_CONFIG_SPACE_SIZE ]; +/* the following fields are read only */ PCIBus *bus;int devfn;@@ -194,6 +201,15 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_reserve_capability (PCIDevice *pci_dev,uint8_t offset,uint8_t size); + +uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id); + +uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len); void pci_default_write_config(PCIDevice *d,Signature · 1 line
1.6.3.1.56.g79e1.dirty
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Glauber CostaQuoted 52 lines · Glauber Costa
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else ditto.
Quoted 4 lines
hw/pci.c +0
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ;
Quoted 16 lines
Quoted 4 lines
hw/pci.c +4
-0+qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
We lose the ability to let user control the capabilities exposed by the device.
And generally, I dislike arbitrary limitations. The PCI spec says the capability can be anywhere, implementing a linked list of caps is simple enough to not invent abritrary restrictions.
Quoted 35 lines
Quoted 24 lines
hw/pci.c +19
-0@@ -870,3 +877,76 @@ PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name)return (PCIDevice *)dev; } + +static int pci_find_space (PCIDevice *pdev,uint8_t size) +{ +int offset =PCI_CONFIG_HEADER_SIZE ; +int i; +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) +if (pdev->used[i]) + offset = i +1 ; +else if (i - offset +1 == size) +return offset; +return 0 ; +} + +static uint8_t pci_find_capability_list (PCIDevice *pdev,uint8_t cap_id, +uint8_t *prev_p) +{ +uint8_t next, prev; + +if (!(pdev->config[PCI_STATUS ] &PCI_STATUS_CAP_LIST ))hw/pci.c PCIDevice *pci_create_simple(PCIBus *bus, int devfn, const char *name) · line 908
Quoted 10 lines
hw/pci.c +10
-0+return 0 ; + +for (prev =PCI_CAPABILITY_LIST ; (next = pdev->config[prev]); + prev = next +PCI_CAP_LIST_NEXT ) +if (pdev->config[next +PCI_CAP_LIST_ID ] == cap_id) +break ; + + *prev_p = prev; +return next; +}I'd prefer to do:
Quoted 4 lines
if (prev_p) *prev_p = prev;so we don't have to always pass a
prev_ppointer. You have yourself a user where you don't need it in this very patch.
Good idea.
Quoted 99 lines
Quoted 99 lines
hw/pci.c +44
-0+ +/* Reserve space and add capability to the linked list in pci config space */ +int pci_add_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t offset =pci_find_space (pdev, size); +uint8_t *config = pdev->config + offset; +if (!offset) +return -ENOSPC ; + config[PCI_CAP_LIST_ID ] = cap_id; + config[PCI_CAP_LIST_NEXT ] = pdev->config[PCI_CAPABILITY_LIST ]; + pdev->config[PCI_CAPABILITY_LIST ] = offset; + pdev->config[PCI_STATUS ] |=PCI_STATUS_CAP_LIST ; +memset (pdev->used + offset,0xFF , size); +/* Make capability read-only by default */ +memset (pdev->wmask + offset,0 , size); +return offset; +} + +/* Unlink capability from the pci config space. */ +void pci_del_capability (PCIDevice *pdev,uint8_t cap_id,uint8_t size) +{ +uint8_t prev, offset =pci_find_capability_list (pdev, cap_id, &prev); +if (!offset) +return ; + pdev->config[prev] = pdev->config[offset +PCI_CAP_LIST_NEXT ]; +/* Make capability writeable again */ +memset (pdev->wmask + offset,0xff , size); +memset (pdev->used + offset,0 , size); + +if (!pdev->config[PCI_CAPABILITY_LIST ]) + pdev->config[PCI_STATUS ] &= ~PCI_STATUS_CAP_LIST ; +} + +/* Reserve space for capability at a known offset (to call after load). */ +void pci_reserve_capability (PCIDevice *pdev,uint8_t offset,uint8_t size) +{ +memset (pdev->used + offset,0xff , size); +} + +uint8_t pci_find_capability (PCIDevice *pdev,uint8_t cap_id) +{ +uint8_t prev; +return pci_find_capability_list (pdev, cap_id, &prev); +}hw/pci.h +17
-1@@ -123,6 +123,10 @@ typedef struct PCIIORegion {#define PCI_MIN_GNT 0x3e/* 8 bits */ #define PCI_MAX_LAT 0x3f/* 8 bits */ +/* Capability lists */ +#define PCI_CAP_LIST_ID 0/* Capability ID */ +#define PCI_CAP_LIST_NEXT 1/* Next capability in the list */ +#define PCI_REVISION 0x08/* obsolete, use PCI_REVISION_ID */ #define PCI_SUBVENDOR_ID 0x2c/* obsolete, use PCI_SUBSYSTEM_VENDOR_ID */ #define PCI_SUBDEVICE_ID 0x2e/* obsolete, use PCI_SUBSYSTEM_ID */ @@ -130,7 +134,7 @@ typedef struct PCIIORegion {/* Bits in the PCI Status Register (PCI 2.3 spec) */ #define PCI_STATUS_RESERVED1 0x007#define PCI_STATUS_INT_STATUS 0x008 -#define PCI_STATUS_CAPABILITIES 0x010 +#define PCI_STATUS_CAP_LIST 0x010#define PCI_STATUS_66MHZ 0x020#define PCI_STATUS_RESERVED2 0x040#define PCI_STATUS_FAST_BACK 0x080@@ -160,6 +164,9 @@ struct PCIDevice {/* Used to implement R/W bytes */ uint8_t wmask[PCI_CONFIG_SPACE_SIZE ]; +/* Used to allocate config space for capabilities. */ +uint8_t used[PCI_CONFIG_SPACE_SIZE ]; +/* the following fields are read only */ PCIBus *bus;int devfn;@@ -194,6 +201,15 @@ void pci_register_io_region(PCIDevice *pci_dev, int region_num, uint32_t size, int type, PCIMapIORegionFunc *map_func); +int pci_add_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_del_capability (PCIDevice *pci_dev,uint8_t cap_id,uint8_t cap_size); + +void pci_reserve_capability (PCIDevice *pci_dev,uint8_t offset,uint8_t size); + +uint8_t pci_find_capability (PCIDevice *pci_dev,uint8_t cap_id); + +uint32_t pci_default_read_config (PCIDevice *d,uint32_t address,int len); void pci_default_write_config(PCIDevice *d,Signature · 1 line
1.6.3.1.56.g79e1.dirty
Signature · 1 line
MST
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 70 lines · Michael S. Tsirkin
Quoted 52 lines · Glauber Costa
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else ditto.
Quoted 4 lines
hw/pci.c +0
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ;Quoted 16 lines
Quoted 4 lines
hw/pci.c +4
-0+qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
Quoted 6 lines
We lose the ability to let user control the capabilities exposed by the device.
And generally, I dislike arbitrary limitations. The PCI spec says the capability can be anywhere, implementing a linked list of caps is simple enough to not invent abritrary restrictions.
yes, but this is migration time, right?
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "pci_device_load" ?
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 71 lines · Glauber Costa
Quoted 70 lines · Michael S. Tsirkin
Quoted 68 lines · Glauber Costa
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else ditto.
Quoted 8 lines
hw/pci.c +4
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ; +qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
Quoted 7 lines
Quoted 6 lines
We lose the ability to let user control the capabilities exposed by the device.
And generally, I dislike arbitrary limitations. The PCI spec says the capability can be anywhere, implementing a linked list of caps is simple enough to not invent abritrary restrictions.
yes, but this is migration time, right?
I think so, yes.
Quoted 5 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?
Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Maybe this explanation should go into the comment above?
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Glauber CostaQuoted 71 lines · Glauber Costa
Quoted 70 lines · Michael S. Tsirkin
Quoted 68 lines · Glauber Costa
Quoted 17 lines · Michael S. Tsirkin
Add routines to manage PCI capability list. First user will be MSI-X.
Signed-off-by Michael S. Tsirkin <[email protected]>--- hw/pci.c | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++------ hw/pci.h | 18 +++++++++++- 2 files changed, 106 insertions(+), 10 deletions(-)hw/pci.c +0
-1@@ -130,12 +130,13 @@ void pci_device_save(PCIDevice *s, QEMUFile *f)int version = s->cap_present ?3 :2 ;int i; -qemu_put_be32 (f, version);/* PCI device version */ hw/pci.c void pci_device_save(PCIDevice *s, QEMUFile *f) · line 140
Quoted 10 lines
hw/pci.c +4
-2+/* PCI device version and capabilities */ +qemu_put_be32 (f, version); +if (version >=3 ) +qemu_put_be32 (f, s->cap_present);qemu_put_buffer (f, s->config,256 );for (i =0 ; i <4 ; i++)qemu_put_be32 (f, s->irq_state[i]); -if (version >=3 ) -qemu_put_be32 (f, s->cap_present); }What is it doing here?
You should just do it right in the first patch, instead of doing in one way there, and fixing here.Quoted 5 lines
hw/pci.c +0
-0int pci_device_load (PCIDevice *s,QEMUFile *f)@@ -146,12 +147,6 @@ int pci_device_load(PCIDevice *s, QEMUFile *f) version_id =qemu_get_be32 (f);if (version_id >3 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 152
Quoted 10 lines
hw/pci.c +0
-6return -EINVAL ; -qemu_get_buffer (f, s->config,256 ); -pci_update_mappings (s); - -if (version_id >=2 ) -for (i =0 ; i <4 ; i ++) - s->irq_state[i] =qemu_get_be32 (f);if (version_id >=3 ) s->cap_present =qemu_get_be32 (f);else ditto.
Quoted 8 lines
hw/pci.c +4
-0@@ -160,6 +155,18 @@ int pci_device_load(PCIDevice *s, QEMUFile *f)if (s->cap_present & ~s->cap_supported)return -EINVAL ; +qemu_get_buffer (f, s->config,256 ); +pci_update_mappings (s); + +if (version_id >=2 )hw/pci.c int pci_device_load(PCIDevice *s, QEMUFile *f) · line 171
Quoted 10 lines
hw/pci.c +8
-0+for (i =0 ; i <4 ; i ++) + s->irq_state[i] =qemu_get_be32 (f); +/* Clear wmask and used bits for capabilities. +Must be restored separately, since capabilities can +be placed anywhere in config space. */ +memset (s->used,0 ,PCI_CONFIG_SPACE_SIZE ); +for (i =PCI_CONFIG_HEADER_SIZE ; i <PCI_CONFIG_SPACE_SIZE ; ++i) + s->wmask[i] =0xff ;return 0 ; }Sorry, I don't exactly understand it. Although it can be anywhere, what do we actually lose by keeping it at the same place in config space?
Quoted 7 lines
Quoted 6 lines
We lose the ability to let user control the capabilities exposed by the device.
And generally, I dislike arbitrary limitations. The PCI spec says the capability can be anywhere, implementing a linked list of caps is simple enough to not invent abritrary restrictions.
yes, but this is migration time, right?
I think so, yes.
Quoted 5 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?
Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Maybe this explanation should go into the comment above?
Signature · 1 line
MST
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Paul
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Michael S. TsirkinQuoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Paul
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 13 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
We should not be loading state into a different device (or a similar device with a different set of capabilities).
Quoted 6 lines
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Paul
Why shouldn't it? You don't load a snapshot while guest is running.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Paul BrookQuoted 13 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
We should not be loading state into a different device (or a similar device with a different set of capabilities).
Quoted 6 lines
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Paul
Why shouldn't it? You don't load a snapshot while guest is running.
Signature · 1 line
MST
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Paul BrookQuoted 10 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Quoted 7 lines
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
If you can create a machine be restoring a snapshot which you can't create by normally starting QEMU, then you'll soon have guests which work fine from their snapshots, but which cannot be booted without a snapshot because there's no way to boot the right machine for the guest.
Ssomeone might even have guests like that for years without noticing, because they always save and restore guest state using snapshots, then one day they simply want to boot the guest from it's disk image and find there's no way to do it with any QEMU which runs on their host platform.
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
-- Jamie
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Paul BrookQuoted 10 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Quoted 7 lines
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
If you can create a machine be restoring a snapshot which you can't create by normally starting QEMU, then you'll soon have guests which work fine from their snapshots, but which cannot be booted without a snapshot because there's no way to boot the right machine for the guest.
Ssomeone might even have guests like that for years without noticing, because they always save and restore guest state using snapshots, then one day they simply want to boot the guest from it's disk image and find there's no way to do it with any QEMU which runs on their host platform.
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
-- Jamie
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 19 lines · Jamie Lokier
Quoted 10 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Quoted 7 lines
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Quoted 4 lines
If you can create a machine be restoring a snapshot which you can't create by normally starting QEMU, then you'll soon have guests which work fine from their snapshots, but which cannot be booted without a snapshot because there's no way to boot the right machine for the guest.
Yes. This clearly isn't what I'm building here. You *can* create a guest without msi-x support by passing an appropriate flag.
Quoted 11 lines
Ssomeone might even have guests like that for years without noticing, because they always save and restore guest state using snapshots, then one day they simply want to boot the guest from it's disk image and find there's no way to do it with any QEMU which runs on their host platform.
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
-- Jamie
And then we'll have the same set of problems there.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Jamie LokierQuoted 19 lines · Jamie Lokier
Quoted 10 lines · Paul Brook
Quoted 9 lines
Quoted 4 lines
caps can be anywhere, but we don't expect it to change during machine execution lifetime.
Or I am just confused by the name "
pci_device_load" ?Right. So I want to load an image and it has capability X at offset Y. wmask has to match. I don't want to assume that we never change Y for the device without breaking old images, so I clear wmask here and set it up again after looking up capabilities that I loaded.
Quoted 7 lines
We should not be loading state into a different device (or a similar device with a different set of capabilities).
If you want to provide backwards compatibility then you should do that by creating a device that is the same as the original. As I mentioned in my earlier mail, loading a snapshot should never do anything that can not be achieved through normal operation.
Quoted 4 lines
If you can create a machine be restoring a snapshot which you can't create by normally starting QEMU, then you'll soon have guests which work fine from their snapshots, but which cannot be booted without a snapshot because there's no way to boot the right machine for the guest.
Yes. This clearly isn't what I'm building here. You *can* create a guest without msi-x support by passing an appropriate flag.
Quoted 11 lines
Ssomeone might even have guests like that for years without noticing, because they always save and restore guest state using snapshots, then one day they simply want to boot the guest from it's disk image and find there's no way to do it with any QEMU which runs on their host platform.
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
-- Jamie
And then we'll have the same set of problems there.
Signature · 1 line
MST
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
Quoted 5 lines · Michael S. Tsirkin
Quoted 3 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
-- Jamie
Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 3 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
-- Jamie
Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 11 lines · Jamie Lokier
Quoted 5 lines · Michael S. Tsirkin
Quoted 3 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 6 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
= Problem 2 - We can't predict the future =
If a VM manager supplies a configuration which is missing any given option, qemu cannot tell the difference between:
- This is a basic config, the VM manager wants whatever the default of the current qemu version
- This is a complete config dumped using an old version of qemu, the VM manager wants the old default
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Cheers,
Mark.
Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Jamie LokierQuoted 11 lines · Jamie Lokier
Quoted 5 lines · Michael S. Tsirkin
Quoted 3 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 6 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
= Problem 2 - We can't predict the future =
If a VM manager supplies a configuration which is missing any given option, qemu cannot tell the difference between:
- This is a basic config, the VM manager wants whatever the default of the current qemu version
- This is a complete config dumped using an old version of qemu, the VM manager wants the old default
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Cheers,
Mark.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Mark McLoughlin
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
Why make it "like the savevm" format then?
If they are opaque anyway, compat hints could be part of savevm format.
Quoted 10 lines
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Cheers,
Mark.
If compat hints are opaque and only editable by qemu, we can get into a situation where one can't create a specific setup with a new qemu.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 6 lines · Mark McLoughlin
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
Why make it "like the savevm" format then?
If they are opaque anyway, compat hints could be part of savevm format.
Quoted 10 lines
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Cheers,
Mark.
If compat hints are opaque and only editable by qemu, we can get into a situation where one can't create a specific setup with a new qemu.
Signature · 1 line
MST
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Mark McLoughlin
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
Why make it "like the savevm" format then?
If they are opaque anyway, compat hints could be part of savevm format.
So a "savevm --only-compat-hints" command? It might make sense, since we would want the compat hints with savevm too.
Quoted 8 lines
Quoted 8 lines
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Quoted 5 lines
Quoted 2 lines
Cheers,
Mark.If compat hints are opaque and only editable by qemu, we can get into a situation where one can't create a specific setup with a new qemu.
An example?
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 10 lines · Michael S. Tsirkin
Quoted 6 lines · Mark McLoughlin
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
Why make it "like the savevm" format then?
If they are opaque anyway, compat hints could be part of savevm format.
So a "savevm --only-compat-hints" command? It might make sense, since we would want the compat hints with savevm too.
Quoted 8 lines
Quoted 8 lines
- Use defaults where compat hints are not available; e.g. if the VM manager specifies a device config, but no compat hints are supplied for it, then just use default values
- Make the config override compat hints; e.g. if there are compat hints specified for a device not included in the machine config, just ignore those hints
Quoted 5 lines
Quoted 2 lines
Cheers,
Mark.If compat hints are opaque and only editable by qemu, we can get into a situation where one can't create a specific setup with a new qemu.
An example?
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 33 lines · Mark McLoughlin
Quoted 12 lines · Jamie Lokier
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 7 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
Quoted 8 lines
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 33 lines · Mark McLoughlin
Quoted 12 lines · Jamie Lokier
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 7 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
Quoted 8 lines
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 38 lines · Anthony Liguori
Quoted 37 lines · Mark McLoughlin
Quoted 12 lines · Jamie Lokier
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 7 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 7 lines
Quoted 4 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Yes, complexity is the issue.
Quoted 2 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
i.e. libvirt produces a qemu configuration (currently a command line) from a guest XML's configuration; with this idea, libvirt would probably compare the old XML config to the new XML config, and then apply those differences to the qemu configuration.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 38 lines · Anthony Liguori
Quoted 37 lines · Mark McLoughlin
Quoted 12 lines · Jamie Lokier
Quoted 6 lines · Michael S. Tsirkin
Quoted 4 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 7 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 7 lines
Quoted 4 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Yes, complexity is the issue.
Quoted 2 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
i.e. libvirt produces a qemu configuration (currently a command line) from a guest XML's configuration; with this idea, libvirt would probably compare the old XML config to the new XML config, and then apply those differences to the qemu configuration.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 57 lines · Mark McLoughlin
Quoted 43 lines · Anthony Liguori
Quoted 41 lines · Mark McLoughlin
Quoted 15 lines · Jamie Lokier
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 8 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 8 lines
Quoted 5 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Yes, complexity is the issue.
Quoted 7 lines
Quoted 3 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
Right, libvirt wants to be able to easily say "add a scsi block device to this VM". The way I see this working is that there would be a default pc.dtc. We would still have a -drive file=foo.img,if=scsi option that would really just be a wrapper around first searching for an existing LSI controller, if one exists, attaching the lun, if not, create one, etc.
libvirt could continue to use this sort of interface. However, as it wants to do more advanced things, it may have to dive into the device tree itself.
On live migration, QEMU will save a copy of the device tree somewhere and libvirt needs to keep track of it. It can treat it as opaque. -M /path/to/foo.dtc -drive file=foo.img,if=scsi should continue working as expected IMHO.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 53 lines · Mark McLoughlin
Quoted 43 lines · Anthony Liguori
Quoted 41 lines · Mark McLoughlin
Quoted 15 lines · Jamie Lokier
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 8 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 7 lines
Quoted 5 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Quoted 9 lines
Yes, complexity is the issue.
Quoted 2 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
Right, libvirt wants to be able to easily say "add a scsi block device to this VM". The way I see this working is that there would be a default pc.dtc. We would still have a -drive file=foo.img,if=scsi option that would really just be a wrapper around first searching for an existing LSI controller, if one exists, attaching the lun, if not, create one, etc.
libvirt could continue to use this sort of interface. However, as it wants to do more advanced things, it may have to dive into the device tree itself.
On live migration, QEMU will save a copy of the device tree somewhere and libvirt needs to keep track of it. It can treat it as opaque. -M /path/to/foo.dtc -drive file=foo.img,if=scsi should continue working as expected IMHO.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 73 lines · Anthony Liguori
Quoted 57 lines · Mark McLoughlin
Quoted 43 lines · Anthony Liguori
Quoted 41 lines · Mark McLoughlin
Quoted 15 lines · Jamie Lokier
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 8 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 8 lines
Quoted 5 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Yes, complexity is the issue.
Quoted 7 lines
Quoted 3 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
Right, libvirt wants to be able to easily say "add a scsi block device to this VM". The way I see this working is that there would be a default pc.dtc. We would still have a -drive file=foo.img,if=scsi option that would really just be a wrapper around first searching for an existing LSI controller, if one exists, attaching the lun, if not, create one, etc.
Quoted 8 lines
libvirt could continue to use this sort of interface. However, as it wants to do more advanced things, it may have to dive into the device tree itself.
On live migration, QEMU will save a copy of the device tree somewhere and libvirt needs to keep track of it. It can treat it as opaque. -M /path/to/foo.dtc -drive file=foo.img,if=scsi should continue working as expected IMHO.
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
The basic problem would be that the command line config would have very limited ability to override the device tree config.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 73 lines · Anthony Liguori
Quoted 57 lines · Mark McLoughlin
Quoted 43 lines · Anthony Liguori
Quoted 41 lines · Mark McLoughlin
Quoted 15 lines · Jamie Lokier
Quoted 8 lines · Michael S. Tsirkin
Quoted 5 lines
I think the right long term answer to all this is a way to get QEMU to dump it's current machine configuration in glorious detail as a file which can be reloaded as a machine configuration.
And then we'll have the same set of problems there.
We will, and the solution will be the same: options to create devices as they were in older versions of QEMU. It only needs to cover device features which matter to guests, not every bug fix.
Quoted 8 lines
However with a machine configuration which is generated by QEMU, there's less worry about proliferation of obscure options, compared with the command line. You don't necessarily have to document every backward-compatibility option in any detail, you just have to make sure it's written and read properly, which is much the same thing as the snapshot code does.
This is a sensible plan, but I don't think we should mix these compat options in with the VM manager supplied configuration.
There are two problems with that approach.
= Problem 1 - VM manager needs to parse qemu config =
Your proposal implies:
- VM manager supplies a basic configuration to qemu
- It then immediately asks qemu for a dump of the machine configuration in all its glorious detail and retains that config
Quoted 8 lines
Quoted 5 lines
- If the VM manager wishes to add a new device it needs to parse the qemu config and add it, rather than just generate an entirely new config
What's the problem with parsing the device config and modifying it? Is it just complexity?
Yes, complexity is the issue.
Quoted 7 lines
Quoted 3 lines
If we provided a mechanism to simplify manipulating a device config, would that eliminate the concern here?
In libvirt's case, a lot of the complexity would come from needing to figure out what to change.
Right, libvirt wants to be able to easily say "add a scsi block device to this VM". The way I see this working is that there would be a default pc.dtc. We would still have a -drive file=foo.img,if=scsi option that would really just be a wrapper around first searching for an existing LSI controller, if one exists, attaching the lun, if not, create one, etc.
Quoted 8 lines
libvirt could continue to use this sort of interface. However, as it wants to do more advanced things, it may have to dive into the device tree itself.
On live migration, QEMU will save a copy of the device tree somewhere and libvirt needs to keep track of it. It can treat it as opaque. -M /path/to/foo.dtc -drive file=foo.img,if=scsi should continue working as expected IMHO.
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
The basic problem would be that the command line config would have very limited ability to override the device tree config.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 13 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
Quoted 8 lines
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
No, the IDE definition would contain some sort of symbolic node name. A separate mechanism (either command line or host config file) would then link a image file to the symbolic name.
libvirt should really never worry about the machine config file for normal things unless it needs to change what devices are exposed to a guest.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 13 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
Quoted 8 lines
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
No, the IDE definition would contain some sort of symbolic node name. A separate mechanism (either command line or host config file) would then link a image file to the symbolic name.
libvirt should really never worry about the machine config file for normal things unless it needs to change what devices are exposed to a guest.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 19 lines · Anthony Liguori
Quoted 18 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
Quoted 6 lines
Quoted 3 lines
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
Quoted 8 lines
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
e.g. a per-device "enable MSI support" flag.
If qemu is supplied with a device tree that lacks that flag, does it enable or disable MSI?
Enable by default is bad - it could be a device tree dumped from an old version of qemu, so compat would be broken.
Disable by default is bad - it could be a simple device tree supplied by the user, and the latest features are wanted.
Maybe we want a per-device "this is a complete device description" flag and if anything is missing from a supposedly complete description, the old defaults would be used. A config dumped from qemu would have this flag set, a config generated by libvirt would not have the flag.
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
No, the IDE definition would contain some sort of symbolic node name. A separate mechanism (either command line or host config file) would then link a image file to the symbolic name.
Okay.
Quoted 2 lines
libvirt should really never worry about the machine config file for normal things unless it needs to change what devices are exposed to a guest.
But changing devices *is* normal ... e.g. removing a block device.
Writing out a device tree is not a problem for libvirt (or any other management tools), it's the need to merge changes into an existing device tree is where the real complexity would lie.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 19 lines · Anthony Liguori
Quoted 18 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
Quoted 6 lines
Quoted 3 lines
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
Quoted 8 lines
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
e.g. a per-device "enable MSI support" flag.
If qemu is supplied with a device tree that lacks that flag, does it enable or disable MSI?
Enable by default is bad - it could be a device tree dumped from an old version of qemu, so compat would be broken.
Disable by default is bad - it could be a simple device tree supplied by the user, and the latest features are wanted.
Maybe we want a per-device "this is a complete device description" flag and if anything is missing from a supposedly complete description, the old defaults would be used. A config dumped from qemu would have this flag set, a config generated by libvirt would not have the flag.
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
No, the IDE definition would contain some sort of symbolic node name. A separate mechanism (either command line or host config file) would then link a image file to the symbolic name.
Okay.
Quoted 2 lines
libvirt should really never worry about the machine config file for normal things unless it needs to change what devices are exposed to a guest.
But changing devices *is* normal ... e.g. removing a block device.
Writing out a device tree is not a problem for libvirt (or any other management tools), it's the need to merge changes into an existing device tree is where the real complexity would lie.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 47 lines · Mark McLoughlin
Quoted 19 lines · Anthony Liguori
Quoted 18 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
Quoted 6 lines
Quoted 3 lines
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
Quoted 8 lines
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
e.g. a per-device "enable MSI support" flag.
If qemu is supplied with a device tree that lacks that flag, does it enable or disable MSI?
Enable by default is bad - it could be a device tree dumped from an old version of qemu, so compat would be broken.
Quoted 7 lines
Disable by default is bad - it could be a simple device tree supplied by the user, and the latest features are wanted.
Maybe we want a per-device "this is a complete device description" flag and if anything is missing from a supposedly complete description, the old defaults would be used. A config dumped from qemu would have this flag set, a config generated by libvirt would not have the flag.
If the device has different behavior or different properties from guest perspective compared to the old device, it should get a new device type so that you could specify in the device tree either the old device or the new one. Flags won't help in the long term.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 4 lines · Blue Swirl
If the device has different behavior or different properties from guest perspective compared to the old device, it should get a new device type so that you could specify in the device tree either the old device or the new one.
Yes, that works - it's analogous to a device (type, version) pair.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Blue SwirlQuoted 4 lines · Blue Swirl
If the device has different behavior or different properties from guest perspective compared to the old device, it should get a new device type so that you could specify in the device tree either the old device or the new one.
Yes, that works - it's analogous to a device (type, version) pair.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 47 lines · Mark McLoughlin
Quoted 19 lines · Anthony Liguori
Quoted 18 lines · Mark McLoughlin
So, when libvirt creates a guest for the first time, it makes a copy of the device tree and continues to use that even if qemu is upgraded. That's enough to ensure compat is retained for all built-in devices.
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ... or:
2) Don't use the command line, instead get a dump of the entire device tree (including the SCSI device) - if the device is to be removed or modified in future, libvirt would need to modify the device tree
Quoted 6 lines
Quoted 3 lines
The basic problem would be that the command line config would have very limited ability to override the device tree config.
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
Quoted 8 lines
To combined to a single thread...
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Please define "attribute". I don't follow what you're asking.
e.g. a per-device "enable MSI support" flag.
If qemu is supplied with a device tree that lacks that flag, does it enable or disable MSI?
Enable by default is bad - it could be a device tree dumped from an old version of qemu, so compat would be broken.
Quoted 7 lines
Disable by default is bad - it could be a simple device tree supplied by the user, and the latest features are wanted.
Maybe we want a per-device "this is a complete device description" flag and if anything is missing from a supposedly complete description, the old defaults would be used. A config dumped from qemu would have this flag set, a config generated by libvirt would not have the flag.
If the device has different behavior or different properties from guest perspective compared to the old device, it should get a new device type so that you could specify in the device tree either the old device or the new one. Flags won't help in the long term.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 5 lines · Mark McLoughlin
Quoted 2 lines
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
As long as qemu can accept a machine config _and_ -drive file=foo (and monitor commands to add/remove devices), libvirt could merge by simply calling qemu with whatever additional command line options or monitor commands modify the config, then dump the new config.
That way, virtio would not have to deal with that complexity. It would be written in one place: qemu.
Or better, a utility: qemu-machine-config.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 5 lines · Mark McLoughlin
Quoted 2 lines
After libvirt has done -drive file=foo... it should dump the machine config and use that from then on.
Right - libvirt then wouldn't be able to avoid the complexity of merging any future changes into the dumped machine config.
As long as qemu can accept a machine config _and_ -drive file=foo (and monitor commands to add/remove devices), libvirt could merge by simply calling qemu with whatever additional command line options or monitor commands modify the config, then dump the new config.
That way, virtio would not have to deal with that complexity. It would be written in one place: qemu.
Or better, a utility: qemu-machine-config.
-- Jamie
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 8 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 8 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Signature · 1 line
MST
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
Quoted 8 lines
Quoted 4 lines
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
Again, details written up here:
https://fedoraproject.org/wiki/Features/KVM_Stable_PCI_Addresses
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 4 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
Quoted 8 lines
Quoted 4 lines
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
Again, details written up here:
https://fedoraproject.org/wiki/Features/KVM_Stable_PCI_Addresses
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addr was never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.
Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
If all devices (including vga, ide) are set up with pci_addr, then this is unneeded. You do need to export available slot numbers from qemu.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addr was never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.
Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
If all devices (including vga, ide) are set up with pci_addr, then this is unneeded. You do need to export available slot numbers from qemu.
Signature · 1 line
error compiling committee.c: too many arguments to function
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 22 lines · Avi Kivity
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addrwas never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.
Quoted 8 lines
Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
If all devices (including vga, ide) are set up with
pci_addr, then this is unneeded.
Right. I think it could be an all or nothing at all approach.
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 22 lines · Avi Kivity
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addrwas never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.
Quoted 8 lines
Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
If all devices (including vga, ide) are set up with
pci_addr, then this is unneeded.
Right. I think it could be an all or nothing at all approach.
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
--
Gleb.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
--
Gleb.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Gleb NatapovQuoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
--
Gleb.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
--
Gleb.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 5 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Gleb Natapov
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Do you mean the KVM kernel module here? I don't know much about the BIOS. Can't qemu control the number of slots declared?
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Gleb NatapovQuoted 5 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 3 lines · Gleb Natapov
Quoted 2 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 2 lines
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Do you mean the KVM kernel module here? I don't know much about the BIOS. Can't qemu control the number of slots declared?
Signature · 1 line
MST
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Gleb Natapov
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Do you mean the KVM kernel module here? I don't know much about the
No I don't mean KVM kernel module here.
Quoted 2 lines
BIOS. Can't qemu control the number of slots declared?
Qemu represents HW, BIOS drives this HW. They should be in sync on such important issues like pci slot configuration. Even if QEMU can control the number of slots declared (which it can't easily do), it will be able to do it only on startup (before BIOS runs). The way to have dynamic number of slots may be pci bridge emulation. Not sure what is needed from BIOS for that.
--
Gleb.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 8 lines · Michael S. Tsirkin
Quoted 7 lines · Gleb Natapov
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Do you mean the KVM kernel module here? I don't know much about the
No I don't mean KVM kernel module here.
Quoted 2 lines
BIOS. Can't qemu control the number of slots declared?
Qemu represents HW, BIOS drives this HW. They should be in sync on such important issues like pci slot configuration. Even if QEMU can control the number of slots declared (which it can't easily do), it will be able to do it only on startup (before BIOS runs). The way to have dynamic number of slots may be pci bridge emulation. Not sure what is needed from BIOS for that.
--
Gleb.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 15 lines · Gleb Natapov
Quoted 14 lines · Michael S. Tsirkin
Quoted 12 lines · Gleb Natapov
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Quoted 7 lines
Quoted 1 line
Do you mean the KVM kernel module here? I don't know much about the
No I don't mean KVM kernel module here.
Quoted 2 lines
BIOS. Can't qemu control the number of slots declared?
Qemu represents HW, BIOS drives this HW. They should be in sync on such important issues like pci slot configuration.
As a simple solution, let's stick to 32 slots per bus. That's the maximum that the PCI spec allows, anyway.
Quoted 3 lines
Even if QEMU can control the number of slots declared (which it can't easily do), it will be able to do it only on startup (before BIOS runs).
That's OK - this is when the machine description is read.
Quoted 3 lines
The way to have dynamic
number of slots may be pci bridge emulation. Not sure what is needed from BIOS for that.
Since bridge can be hot-plugged, probably nothing? But we don't necessarily need dynamic number of slots IMO.
Quoted 3 lines
--
Gleb.
Signature · 1 line
MST
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Gleb NatapovQuoted 15 lines · Gleb Natapov
Quoted 14 lines · Michael S. Tsirkin
Quoted 12 lines · Gleb Natapov
Quoted 9 lines · Michael S. Tsirkin
Quoted 6 lines · Gleb Natapov
Quoted 4 lines · Michael S. Tsirkin
Quoted 1 line
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
Because it does not exist?
We can create a slot with any number, can't we?
What do you mean? If the mobo has 4 slots you can't create fifth. KVM describes 32 slots in the BIOS.
Quoted 7 lines
Quoted 1 line
Do you mean the KVM kernel module here? I don't know much about the
No I don't mean KVM kernel module here.
Quoted 2 lines
BIOS. Can't qemu control the number of slots declared?
Qemu represents HW, BIOS drives this HW. They should be in sync on such important issues like pci slot configuration.
As a simple solution, let's stick to 32 slots per bus. That's the maximum that the PCI spec allows, anyway.
Quoted 3 lines
Even if QEMU can control the number of slots declared (which it can't easily do), it will be able to do it only on startup (before BIOS runs).
That's OK - this is when the machine description is read.
Quoted 3 lines
The way to have dynamic
number of slots may be pci bridge emulation. Not sure what is needed from BIOS for that.
Since bridge can be hot-plugged, probably nothing? But we don't necessarily need dynamic number of slots IMO.
Quoted 3 lines
--
Gleb.
Signature · 1 line
MST
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
A slot needs to be configured in ACPI, and not be taken by onboard chips (piix takes slot 0, for example).
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
A slot needs to be configured in ACPI, and not be taken by onboard chips (piix takes slot 0, for example).
Signature · 1 line
error compiling committee.c: too many arguments to function
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
Quoted 2 lines
and not be taken by onboard chips
(piix takes slot 0, for example).
piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 8 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
You do need to export available slot numbers from qemu.
Why would a slot be unavailable?
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
Quoted 2 lines
and not be taken by onboard chips
(piix takes slot 0, for example).
piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
Quoted 2 lines
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
That's what we do. But one is always taken. In the future, perhaps more.
Quoted 7 lines
Quoted 3 lines
and not be taken by onboard chips
(piix takes slot 0, for example).piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
We should just tell the user which slots are open.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
That's what we do. But one is always taken. In the future, perhaps more.
Quoted 7 lines
Quoted 3 lines
and not be taken by onboard chips
(piix takes slot 0, for example).piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
We should just tell the user which slots are open.
Signature · 1 line
error compiling committee.c: too many arguments to function
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 13 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
That's what we do. But one is always taken. In the future, perhaps more.
Quoted 4 lines
Quoted 3 lines
and not be taken by onboard chips
(piix takes slot 0, for example).
Quoted 5 lines
Quoted 3 lines
piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 13 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
Quoted 2 lines
A slot needs to be configured in ACPI,
Can we configure all possible 32 slots?
That's what we do. But one is always taken. In the future, perhaps more.
Quoted 4 lines
Quoted 3 lines
and not be taken by onboard chips
(piix takes slot 0, for example).
Quoted 5 lines
Quoted 3 lines
piix is the root complex, isn't it? Are there other examples? If not, we could teach management about the root complex being special ...
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
qemu -show-available-pci-slots
(the qemu equivalent to KVM_CHECK_EXTENSION)
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 6 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
qemu -show-available-pci-slots
(the qemu equivalent to KVM_CHECK_EXTENSION)
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's not a good idea to have management applications attempt to do PCI slot allocation. For instance, one day we may decide to make virtio devices multi-function.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 8 lines · Avi Kivity
Quoted 5 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line flags.
qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's not a good idea to have management applications attempt to do PCI slot allocation. For instance, one day we may decide to make virtio devices multi-function.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Anthony Liguori
Quoted 5 lines · Avi Kivity
Quoted 3 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line
flags.
Quoted 6 lines
Quoted 1 line
qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's a roundabout way of doing things.
As an example, if you try to fit too many devices into the machine, you have to try to add all devices and watch for a qemu error. If you know in advance how many slots you have, you never enter into that situation (and you need to show the limit to the user anyway).
Quoted 4 lines
It's not a good idea to have management applications attempt to do PCI slot allocation. For instance, one day we may decide to make virtio devices multi-function.
Non-virtio, as well. But we can't make that the default, so the user will have to specify this anyway.
Given that you can't hotunplug individual functions, the user will have to specify exactly how functions are aggregated into devices. My recommendation would be for a GUI to allow the user to select a 'quad port virtio NIC' or 'dual port virtio scsi controller' rather than trying to do anything automatic.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 11 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Quoted 3 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command line
flags.qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's a roundabout way of doing things.
As an example, if you try to fit too many devices into the machine, you have to try to add all devices and watch for a qemu error. If you know in advance how many slots you have, you never enter into that situation (and you need to show the limit to the user anyway).
Quoted 2 lines
It's not a good idea to have management applications attempt to do PCI slot allocation. For instance, one day we may decide to make virtio devices multi-function.
Non-virtio, as well. But we can't make that the default, so the user will have to specify this anyway.
Given that you can't hotunplug individual functions, the user will have to specify exactly how functions are aggregated into devices. My recommendation would be for a GUI to allow the user to select a 'quad port virtio NIC' or 'dual port virtio scsi controller' rather than trying to do anything automatic.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command
line
flags.
Quoted 8 lines
Quoted 6 lines
Quoted 1 line
qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's a roundabout way of doing things.
Having libvirt do PCI slot allocation scares me. It assumes we can return a whitelist of available slots, and then let libvirt just randomly assign things. There's knowledge though in slot assignment that's board-specific. For instance, depending on how many LNK lines you have, you may want to put things in slots in such a way to optimize interrupt balancing or something like that.
Some platforms have quirks about expecting a particular slot to have a particular device. It's still an optimal device but it has to be in that slot. You can't really express that via an available slot list.
Quoted 8 lines
Non-virtio, as well. But we can't make that the default, so the user will have to specify this anyway.
Given that you can't hotunplug individual functions, the user will have to specify exactly how functions are aggregated into devices. My recommendation would be for a GUI to allow the user to select a 'quad port virtio NIC' or 'dual port virtio scsi controller' rather than trying to do anything automatic.
Yeah, I haven't thought much about that.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 8 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Quoted 4 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command
line
flags.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's a roundabout way of doing things.
Having libvirt do PCI slot allocation scares me. It assumes we can return a whitelist of available slots, and then let libvirt just randomly assign things. There's knowledge though in slot assignment that's board-specific. For instance, depending on how many LNK lines you have, you may want to put things in slots in such a way to optimize interrupt balancing or something like that.
Some platforms have quirks about expecting a particular slot to have a particular device. It's still an optimal device but it has to be in that slot. You can't really express that via an available slot list.
Quoted 3 lines
Non-virtio, as well. But we can't make that the default, so the user will have to specify this anyway.
Given that you can't hotunplug individual functions, the user will have to specify exactly how functions are aggregated into devices. My recommendation would be for a GUI to allow the user to select a 'quad port virtio NIC' or 'dual port virtio scsi controller' rather than trying to do anything automatic.
Yeah, I haven't thought much about that.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 16 lines · Anthony Liguori
Quoted 15 lines · Avi Kivity
Quoted 13 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command
line
flags.qemu -show-available-pci-slots
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
Quoted 8 lines
Quoted 1 line
It's a roundabout way of doing things.
Having libvirt do PCI slot allocation scares me. It assumes we can return a whitelist of available slots, and then let libvirt just randomly assign things. There's knowledge though in slot assignment that's board-specific. For instance, depending on how many LNK lines you have, you may want to put things in slots in such a way to optimize interrupt balancing or something like that.
How would qemu know which slots to optimize for?
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Quoted 3 lines
Some platforms have quirks about expecting a particular slot to have a particular device. It's still an optimal device but it has to be in that slot. You can't really express that via an available slot list.
I'll be surprised if we ever measure different dma speeds on different slots in the qemu virtual pci bus. If we do, we'll find a way to express them:
$ qemu -print-pci slot 0:01: available 33MHz slot 0:02: available 33MHz slot 0:03: available 66MHz
I feel a little silly typing this.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 11 lines · Anthony Liguori
Quoted 10 lines · Avi Kivity
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity
Quoted 4 lines · Michael S. Tsirkin
We should just tell the user which slots are open.
This might be tricky if the config is passed in with the command
line
flags.qemu -show-available-pci-slots
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
Why does the user care?
Let QEMU allocate the PCI slot, then query it to see what slot it assigned and remember that.
It's a roundabout way of doing things.
Having libvirt do PCI slot allocation scares me. It assumes we can return a whitelist of available slots, and then let libvirt just randomly assign things. There's knowledge though in slot assignment that's board-specific. For instance, depending on how many LNK lines you have, you may want to put things in slots in such a way to optimize interrupt balancing or something like that.
How would qemu know which slots to optimize for?
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Quoted 1 line
Some platforms have quirks about expecting a particular slot to have a particular device. It's still an optimal device but it has to be in that slot. You can't really express that via an available slot list.
I'll be surprised if we ever measure different dma speeds on different slots in the qemu virtual pci bus. If we do, we'll find a way to express them:
$ qemu -print-pci slot 0:01: available 33MHz slot 0:02: available 33MHz slot 0:03: available 66MHz
I feel a little silly typing this.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 4 lines · Avi Kivity
On 06/15/2009 04:23 PM, Anthony Liguori wrote:
How would qemu know which slots to optimize for?
Quoted 8 lines
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Let's take a concrete example because I think you missed my point. For the r2d board, if you have 1 on-board NIC, it has to go in slot 2. Additional NICs can go in any slot, but the primary on-board NIC is expected to live in slot 2. It's possible to not have that on-board NIC.
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 7 lines · Avi Kivity
On 06/15/2009 04:23 PM, Anthony Liguori wrote:
How would qemu know which slots to optimize for?
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Let's take a concrete example because I think you missed my point. For the r2d board, if you have 1 on-board NIC, it has to go in slot 2. Additional NICs can go in any slot, but the primary on-board NIC is expected to live in slot 2. It's possible to not have that on-board NIC.
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 14 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity
On 06/15/2009 04:23 PM, Anthony Liguori wrote:
How would qemu know which slots to optimize for?
Quoted 8 lines
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Quoted 5 lines
Let's take a concrete example because I think you missed my point. For the r2d board, if you have 1 on-board NIC, it has to go in slot
2. Additional NICs can go in any slot, but the primary on-board NIC is expected to live in slot 2. It's possible to not have that on-board NIC.
Libvirt does not support r2d. I hope it won't start to support it. We can have default values for these types of devices or something like pci_addr=auto.
Quoted 9 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some
get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
Also, while moving from one qemu version to another, you'll need to represent the older behavior. -qemu-0.10 is not good enough since there will be multiple versions in the future with multiple distributions setting their defaults.
Quoted 5 lines
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 10 lines · Anthony Liguori
Quoted 7 lines · Avi Kivity
On 06/15/2009 04:23 PM, Anthony Liguori wrote:
How would qemu know which slots to optimize for?
In practice, I don't see that as a real problem. We should (a) add an ioapic and four more pci links (b) recommend that slots be assigned in ascending order, and everything works.
I don't see your concern about libvirt allocating slots. If a human can plug a card into a slot, so can libvirt. Doing an interactive back-and-forth (equivalent to plugging a card while blindfolded, then looking to see which slot we hit) is certainly more difficult.
Let's take a concrete example because I think you missed my point. For the r2d board, if you have 1 on-board NIC, it has to go in slot 2. Additional NICs can go in any slot, but the primary on-board NIC is expected to live in slot 2. It's possible to not have that on-board NIC.
Libvirt does not support r2d. I hope it won't start to support it.
We can have default values for these types of devices or something like pci_addr=auto.
Quoted 5 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
Also, while moving from one qemu version to another, you'll need to represent the older behavior. -qemu-0.10 is not good enough since there will be multiple versions in the future with multiple distributions setting their defaults.
Quoted 5 lines
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
Quoted 2 lines
We can have default values for these types of devices or something like pci_addr=auto.
Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?
Quoted 9 lines
Quoted 8 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Quoted 6 lines
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
I'm not at all arguing against pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
Regards,
Anthony Liguori
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 31 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
Quoted 2 lines
We can have default values for these types of devices or something like pci_addr=auto.
Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?
Quoted 9 lines
Quoted 8 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Quoted 6 lines
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
Quoted 4 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Quoted 3 lines
Regards,
Anthony Liguori
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 31 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
Quoted 2 lines
We can have default values for these types of devices or something like pci_addr=auto.
Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?
Quoted 9 lines
Quoted 8 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Quoted 6 lines
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
Quoted 4 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Quoted 3 lines
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Michael S. Tsirkin
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Why does libvirt want to do allocation?
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 6 lines · Michael S. Tsirkin
Quoted 2 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Why does libvirt want to do allocation?
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
Quoted 5 lines
Quoted 3 lines
The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Why does libvirt want to do allocation?
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
Regards,
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 6 lines · Michael S. Tsirkin
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
Quoted 5 lines
Quoted 3 lines
The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Why does libvirt want to do allocation?
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
Regards,
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 14 lines · Daniel P. Berrange
Quoted 12 lines · Anthony Liguori
Quoted 10 lines · Michael S. Tsirkin
Quoted 6 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Quoted 9 lines
Quoted 2 lines
Why does libvirt want to do allocation?
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
It's not about what libvirt wants. It's about what will serve the end user the most.
Apart for stable guest ABI, end users need to have the option to control the slot for
their devices. Just like them have for physical machines. It's not theoretical discussion,
limiting issues with shared irq is one real life example.
Thanks, dor
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Daniel P. BerrangeQuoted 11 lines · Daniel P. Berrange
Quoted 9 lines · Anthony Liguori
Quoted 7 lines · Michael S. Tsirkin
Quoted 3 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.The allocation code could be moved out into a library, and libvirt could link with it (ducks).
Quoted 9 lines
Quoted 2 lines
Why does libvirt want to do allocation?
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
It's not about what libvirt wants. It's about what will serve the end user the most. Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.
Thanks, dor
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 11 lines · Dor Laor
Quoted 9 lines
It doesn't want to. As Mark said, libvirt just wants to be able to ensure
a stable guest ABI, of which stable PCI addresses is one aspect. This does
not imply libvirt wants to allocate the PCI addresses, just that it wants
a way to keep them stable. All else being equal I'd rather libvirt wasn't
in the PCI address allocation business.
Quoted 8 lines
It's not about what libvirt wants. It's about what will serve the end user the most.
Apart for stable guest ABI, end users need to have the option to control the slot for
their devices. Just like them have for physical machines. It's not theoretical discussion,
limiting issues with shared irq is one real life example.
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Dor LaorQuoted 7 lines · Dor Laor
Quoted 5 lines
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
Quoted 5 lines
It's not about what libvirt wants. It's about what will serve the end user the most. Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 4 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 4 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 11 lines · Jamie Lokier
Quoted 5 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.
virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Jamie LokierQuoted 11 lines · Jamie Lokier
Quoted 5 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.
virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Jamie Lokier
Quoted 4 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
Quoted 7 lines
virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.
virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.
I guess I meant virtio disks, so that's ok.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 11 lines · Avi Kivity
Quoted 9 lines · Jamie Lokier
Quoted 4 lines · Avi Kivity
Another issue is enumeration. Guests will present their devices in the order they find them on the pci bus (of course enumeration is guest specific). So if I have 2 virtio controllers the only way I can distinguish between them is using their pci slots.
virtio controllers really should have a user-suppliable string or UUID to identify them to the guest. Don't they?
Quoted 7 lines
virtio controllers don't exist. When they do, they may have a UUID or not, but in either case guest infrastructure is in place for reporting the PCI slot, not the UUID.
virtio disks do have a UUID. I don't think older versions of Windows will use it though, so if you reorder your slots you'll see your drive letters change. Same with Linux if you don't use udev by-uuid rules.
I guess I meant virtio disks, so that's ok.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Dor LaorQuoted 9 lines · Dor Laor
Quoted 6 lines
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
It's not about what libvirt wants. It's about what will serve the end user the most.
Absolutely. And not just about what most helps end users of libvirt based management apps, but also any app managing qemu.
Quoted 4 lines
Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.
Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.
Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Dor LaorQuoted 9 lines · Dor Laor
Quoted 6 lines
It doesn't want to. As Mark said, libvirt just wants to be able to ensure a stable guest ABI, of which stable PCI addresses is one aspect. This does not imply libvirt wants to allocate the PCI addresses, just that it wants a way to keep them stable. All else being equal I'd rather libvirt wasn't in the PCI address allocation business.
It's not about what libvirt wants. It's about what will serve the end user the most.
Absolutely. And not just about what most helps end users of libvirt based management apps, but also any app managing qemu.
Quoted 4 lines
Apart for stable guest ABI, end users need to have the option to control the slot for their devices. Just like them have for physical machines. It's not theoretical discussion, limiting issues with shared irq is one real life example.
Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.
Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 7 lines · Mark McLoughlin
Providing end users with the *option* to choose PCI slots sounds like a fine feature request for any management app.
Requiring all management apps to force end users to explicitly choose PCI slots in order for slots to be stable is not so reasonable.
Think any installer's partitioning utility. It will provide a default placement and try to hide it from you. If you ask, it will let you place the partitions yourself.
The management app is the end user's agent. When we push something there, we allow it to choose something, or push the decision further up to the user.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.
Quoted 8 lines
Quoted 3 lines
We can have default values for these types of devices or something like pci_addr=auto.
Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?
Error messages are not the only argument for pushing slot allocation to management. See my previous messages on the topic.
Quoted 17 lines
Quoted 10 lines
Quoted 9 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
Quoted 6 lines
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 4 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.
Quoted 4 lines
Quoted 2 lines
We can have default values for these types of devices or something like pci_addr=auto.
Why wouldn't libvirt always use pci_addr=auto? If the only argument for having libvirt do pci slot allocation is error messages, can't we find a nice way to allow libvirt to create friendly error messages when QEMU fails?
Error messages are not the only argument for pushing slot allocation to management. See my previous messages on the topic.
Quoted 10 lines
Quoted 8 lines
Quoted 4 lines
If you let QEMU allocate which PCI slot a device goes in, we can hide this detail from libvirt. If you have libvirt do PCI slot allocation by default, it has to know about this restriction in the r2d board unless you have a clever way to express this sort of information.
Once QEMU has allocated a device to a slot, libvirt can do a good job maintaining that relationship.
The end user should have a mechanism to control device slot positioning. For example, if you have several pci devices, some get high rate of interrupts and some not, if you want to optimize you guest you should isolate the high rate 'interesting' devices. This is something the user will need to do. I agree that the default behavior might be 'auto'
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 3 lines · Avi Kivity
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
I'm not sure how we got here but yeah, let's table this part of the discussion.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 1 line · Avi Kivity
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
I'm not sure how we got here but yeah, let's table this part of the discussion.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 9 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
Quoted 4 lines
I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
Quoted 9 lines
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
You can push the discussion to libvirt-devel, and the conclusion would most likely be:
"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.
We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."
libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 9 lines · Avi Kivity
Quoted 7 lines · Anthony Liguori
Quoted 1 line · Dor Laor
Libvirt does not support r2d. I hope it won't start to support it.
It supports mips, sparc, and ppc machines now. I don't see why it wouldn't support r2d. For ppcemb, I expect this same problem to occur. This sort of restriction is going to be common with embedded boards.
Quoted 4 lines
I expect these restrictions will have to be known by the management application. Otherwise the users will try invalid configurations only to receive errors when they launch them. GUIs exist to guide users, not as an inefficient means of trial-and-error.
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
Quoted 9 lines
Quoted 5 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
You can push the discussion to libvirt-devel, and the conclusion would most likely be:
"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.
We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."
libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Mark McLoughlin
Quoted 4 lines
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
We propose to allow both qemu-allocated slots and user-allocated slots, so we're only ignoring the actual decision by the management tool providers, not their requirements.
Quoted 10 lines
You can push the discussion to libvirt-devel, and the conclusion would most likely be:
"We can do slot allocation if you provide us with a way to query free
slots, or we can use qemu's default allocation if you provide us a way to query the allocation.We'd prefer the default allocation problem, but we don't really care. Both require about the same amount of work for us."
Well, they'll find out if they try default allocation. It's traditional to try all the complicated solutions before trying the simplest one, so I guess we'll just have to let them.
Quoted 3 lines
libvirt was only mentioned in this thread as a concrete example of how the suggested solutions would actually be used by management apps.
True, others will wind up doing things differently. In fact, I'm a little surprised that libvirt is involved, since the place to do inventory is in the management app itself (it's true that libvirt also maintains its own database, so the line is blurred).
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
_______________________________________________
Virtualization mailing list
[email protected]
https://lists.linux-foundation.org/mailman/listinfo/virtualization
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 3 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed. It doesn't matter though because it's orthogonal to the current proposal.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.
Quoted 8 lines
Quoted 4 lines
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.
To summarize, I think we have:
1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 3 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed. It doesn't matter though because it's orthogonal to the current proposal.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.
To summarize, I think we have:
1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 3 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
s/whenever/qemu stable release/
Quoted 1 line
- Use explicit versions in name: pc-v1, pc-v2
pc-qemu-0.10?
This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)
Quoted 2 lines
or use more descriptive names pc-with-usb
- Easily transitions to device config files
Combinatorial explosion. Just use -usb.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
s/whenever/qemu stable release/
Quoted 1 line
- Use explicit versions in name: pc-v1, pc-v2
pc-qemu-0.10?
This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)
Quoted 2 lines
or use more descriptive names pc-with-usb
- Easily transitions to device config files
Combinatorial explosion. Just use -usb.
Signature · 2 lines
I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 7 lines · Avi Kivity
Quoted 3 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
s/whenever/qemu stable release/
Quoted 7 lines
Quoted 1 line
- Use explicit versions in name: pc-v1, pc-v2
pc-qemu-0.10?
This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)
Yup, that makes a whole lot of sense.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 11 lines · Avi Kivity
Quoted 2 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
s/whenever/qemu stable release/
Quoted 1 line
- Use explicit versions in name: pc-v1, pc-v2
pc-qemu-0.10?
This is similar to a hardware vendor's model number (though they tend to change components without changing model numbers, though naughty vendors)
Yup, that makes a whole lot of sense.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 7 lines · Avi Kivity
Quoted 2 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way,
introduce a new machine type
Quoted 1 line
Quoted 7 lines
s/whenever/qemu stable release/
Quoted 2 lines
- Use explicit versions in name: pc-v1, pc-v2
pc-qemu-0.10?
pc-2009.06? Or given the hardware, should that be pc-1997?
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 5 lines · Blue Swirl
Quoted 2 lines
pc-qemu-0.10?
pc-2009.06? Or given the hardware, should that be pc-1997?
pc-qemu-0.10 has the obvious benefit of allowing people to immediately know what's the oldest version of qemu that supports it.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Blue SwirlQuoted 5 lines · Blue Swirl
Quoted 2 lines
pc-qemu-0.10?
pc-2009.06? Or given the hardware, should that be pc-1997?
pc-qemu-0.10 has the obvious benefit of allowing people to immediately know what's the oldest version of qemu that supports it.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 3 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
Quoted 1 line
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.Quoted 8 lines
Quoted 4 lines
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.
Quoted 6 lines
To summarize, I think we have:
1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.
That helps, but it's not enough on its own.
The management app needs to figure out what addresses to pass either by:
a) Initially allowing qemu to do the address allocation, and thereafter using those addresses - this requires some way to query the addresses of devices
or b) Doing the initial address allocation itself - this requires some
way to query what slots are available.
Quoted 5 lines
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files
To be clear - you're not proposing this is a solution to the "stable PCI addresses" problem, are you? The main requirement is for the addresses to stay stable even if the user adds/removes other devices.
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 3 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
Quoted 1 line
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
Quoted 18 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
I'm not at all arguing against
pci_addr. I'm arguing about how libvirt should use it with respect to the "genesis" use-case where libvirt has no specific reason to choose one PCI slot over another. In that case, I'm merely advocating that we want to let QEMU make the decision.Quoted 8 lines
Quoted 4 lines
However this may end up, isn't it offtopic? Whatever we do we have to support both pci_addr= and default placement, so we can push this discussion to livirt-devel and bid them godspeed.
Presumably you're not proposing that qemu-devel completely ignore the typical requirements of management apps?
This is a happy case where the current proposals allow both usages to occur. Which one libvirt chooses it up to it.
Quoted 6 lines
To summarize, I think we have:
1) Introduce addressing to all host device configurations
- Either in the canonical form "pci_addr=bus:dev.fn or target=3,lun=1"
or in flattened form "addr=bus:dev.fn or addr=target.lun". I prefer the later form but I think either would be acceptable.
That helps, but it's not enough on its own.
The management app needs to figure out what addresses to pass either by:
a) Initially allowing qemu to do the address allocation, and thereafter using those addresses - this requires some way to query the addresses of devices
or b) Doing the initial address allocation itself - this requires some
way to query what slots are available.
Quoted 5 lines
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files
To be clear - you're not proposing this is a solution to the "stable PCI addresses" problem, are you? The main requirement is for the addresses to stay stable even if the user adds/removes other devices.
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Mark McLoughlin
Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
Quoted 8 lines
Quoted 3 lines
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards. Worst case we hardcode those numbers (gasp, faint).
Quoted 6 lines
Quoted 2 lines
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
It's part of the solution, but hardly a difficult the most difficult part.
Quoted 3 lines
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
$ qemu -print-default-machine
or maybe
$ qemu -show default-machine
$ qemu -show pci-bus
$ qemu -show me a way outSignature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 8 lines · Mark McLoughlin
Quoted 6 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
Quoted 8 lines
Quoted 3 lines
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards. Worst case we hardcode those numbers (gasp, faint).
Quoted 6 lines
Quoted 2 lines
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
It's part of the solution, but hardly a difficult the most difficult part.
Quoted 3 lines
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
$ qemu -print-default-machine
or maybe
$ qemu -show default-machine
$ qemu -show pci-bus
$ qemu -show me a way outSignature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 13 lines · Avi Kivity
Quoted 12 lines · Mark McLoughlin
Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
Quoted 7 lines
Quoted 4 lines
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards.
If they're so obviously well-known, I don't see how the query mechanism would not be straightforward, which is the comment I was replying to.
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
It's part of the solution, but hardly a difficult the most difficult part.
Agree.
Quoted 5 lines
Quoted 3 lines
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
$ qemu -print-default-machine
Or:
$ readlink /usr/share/qemu/machine-types/pc.dt
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 13 lines · Avi Kivity
Quoted 12 lines · Mark McLoughlin
Quoted 9 lines · Anthony Liguori
Quoted 4 lines · Mark McLoughlin
So long as the restrictions would be known to the management app via some "what slots are available" mechanism in qemu, that sounds fine.
I'm not sure a "what slots are available" mechanism is as straight forward as has been claimed.
Quoted 7 lines
Quoted 4 lines
If qemu can't provide that information, then the management app does not have sufficient information to do the slot allocation itself. In which case, it must leave it up to qemu to do it.
A given -M machine will have well-known open slots (since it's an ABI), same as it has rtl8139 and ne2000 cards.
If they're so obviously well-known, I don't see how the query mechanism would not be straightforward, which is the comment I was replying to.
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Quoted 8 lines
Quoted 6 lines
Quoted 2 lines
It doesn't matter though because it's orthogonal to the current proposal.
It is not orthogonal to solving the actual problem at hand, though - i.e. how to allow management apps to provide stable PCI addresses.
It's part of the solution, but hardly a difficult the most difficult part.
Agree.
Quoted 5 lines
Quoted 3 lines
This is a fine solution to the "stable guest ABI" problem ... assuming there's some way of querying the current default machine type.
$ qemu -print-default-machine
Or:
$ readlink /usr/share/qemu/machine-types/pc.dt
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Mark McLoughlin
Quoted 2 lines
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Yeah, there's precedent too.
Quoted 5 lines
Or:
$ readlink /usr/share/qemu/machine-types/pc.dt
That works if you have exactly one qemu installed. It's best if qemu itself is the entry point (qemu -print-device-tree).
Though I wouldn't want to inflict it upon the management application writers.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 6 lines · Mark McLoughlin
Quoted 2 lines
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Yeah, there's precedent too.
Quoted 5 lines
Or:
$ readlink /usr/share/qemu/machine-types/pc.dt
That works if you have exactly one qemu installed. It's best if qemu itself is the entry point (qemu -print-device-tree).
Though I wouldn't want to inflict it upon the management application writers.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 4 lines · Mark McLoughlin
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Make them part of the machine configuration.
After all, they are part of the machine configuration, and ACPI, BIOS etc. need to know about all the machine slots anyway.
Having said that, I prefer the idea that slot allocation is handled either in Qemu, or in a separate utility called qemu-machine-config (for working with machine configs), or in a library libqemu-machine-config.so.
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 5 lines · Jamie Lokier
Quoted 4 lines · Mark McLoughlin
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
I was being sarcastic - libvirt currently must parse qemu -help, and even has some test infrastructure to check that it works with various versions of qemu. Extending this would not be nice and clean :-)
Quoted 4 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Jamie LokierQuoted 5 lines · Jamie Lokier
Quoted 4 lines · Mark McLoughlin
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
I was being sarcastic - libvirt currently must parse qemu -help, and even has some test infrastructure to check that it works with various versions of qemu. Extending this would not be nice and clean :-)
Quoted 4 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 8 lines · Mark McLoughlin
Quoted 5 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this. Management already has to allocate MAC addresses, UUIDs, IDE interface and master/slave role, SCSI LUNs/targets/whatever. It has to understand NUMA (if not do actual allocation). Even if it doesn't allocate the slots, it has to be able to query them so it can tell the user which NIC or controller is connected where, or to do hotunplug. It has to understand that there is a limitation on the number of slots, and know what that limitation is (unless it feels that launching an overcommitted guest and showing an error to the user is preferable to not allowing the user to overcommit in the first place.
If you'll review my patent application for pci slot allocation, you'll see the following line:
slot_nr = nb_allocated_slots++; /* Allocate pci slot */
while there is a lot of complicated setup code before that (see the prior art section as well), I believe licensees could well implement the algorithm in two short months, including testing.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 8 lines · Mark McLoughlin
Quoted 5 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this. Management already has to allocate MAC addresses, UUIDs, IDE interface and master/slave role, SCSI LUNs/targets/whatever. It has to understand NUMA (if not do actual allocation). Even if it doesn't allocate the slots, it has to be able to query them so it can tell the user which NIC or controller is connected where, or to do hotunplug. It has to understand that there is a limitation on the number of slots, and know what that limitation is (unless it feels that launching an overcommitted guest and showing an error to the user is preferable to not allowing the user to overcommit in the first place.
If you'll review my patent application for pci slot allocation, you'll see the following line:
slot_nr = nb_allocated_slots++; /* Allocate pci slot */
while there is a lot of complicated setup code before that (see the prior art section as well), I believe licensees could well implement the algorithm in two short months, including testing.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Avi Kivity
Quoted 6 lines · Mark McLoughlin
Quoted 4 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this.
Take note of the "arcane machine-dependent slot allocation knowledge" bit.
If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 9 lines · Avi Kivity
Quoted 6 lines · Mark McLoughlin
Quoted 4 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this.
Take note of the "arcane machine-dependent slot allocation knowledge" bit.
If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 14 lines · Mark McLoughlin
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Mark McLoughlin
Quoted 5 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this.
Quoted 7 lines
Take note of the "arcane machine-dependent slot allocation knowledge" bit.
If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.
That's the thinking.
Quoted 5 lines
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.
Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.
It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 14 lines · Mark McLoughlin
Quoted 11 lines · Avi Kivity
Quoted 7 lines · Mark McLoughlin
Quoted 5 lines
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
Indeed.
I don't understand this.
Quoted 7 lines
Take note of the "arcane machine-dependent slot allocation knowledge" bit.
If the algorithm in for management apps is as simple as "query qemu for available slots and sequentially allocate slots", then that's perfectly fine.
That's the thinking.
Quoted 5 lines
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.
Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.
It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 16 lines · Avi Kivity
Quoted 5 lines
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.
Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.
Quoted 6 lines
It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.
To be honest, an elaborate machine description is probably fine...
A fancy constraint solver is not required. A simple one strikes me as about as simple as what you'd hard-code anyway, but with fewer special cases.
Note that the result can fail due to things like insufficient address space for all the device BARs even when they _are_ in the right slots. Especially if there are lots of slots, or bridges which can provide unlimited slots.
That is arcane: device-dependent, CPU-dependent, machine-dependent, RAM-size dependent (in a non-linear way), device-option-dependent and probably QEMU-version-dependent too.
It would be nice if libvirt (et al) would prevent the user from creating a VM with insufficient BAR space for that machine, but I'm not sure how to do it sanely, without arcane knowledge getting about.
Maybe that idea of a .so shared by qemu and libvirt, to manipulate device configurations, is a sane one after all.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 16 lines · Avi Kivity
Quoted 5 lines
If management apps need to hard-code which slots are available on different targets and different qemu versions, or restrictions on which devices can use which slots, or knowledge that some devices can be multi-function, or ... anything like that is just lame.
You can't abstract these things away. If you can't put a NIC in slot 4, and you have 7 slots, then you cannot have 7 NICs. Having qemu allocate the slot numbers does not absolve management from knowing this limitation and preventing the user from creating a machine with 7 slots.
Likewise, management will have to know which devices are multi-function, since that affects their hotpluggability. Ditto if some slot if faster than others, if you want to make use of this information you have to let the upper layers know.
Quoted 6 lines
It could be done using an elaborate machine description that qemu exposes to management coupled with a constraint solver that optimizes the machine layout according to user specifications and hardware limitations. Or we could take the view that real life is not perfect (especially where computers are involved), add some machine specific knowledge, and spend the rest of the summer at the beach.
To be honest, an elaborate machine description is probably fine...
A fancy constraint solver is not required. A simple one strikes me as about as simple as what you'd hard-code anyway, but with fewer special cases.
Note that the result can fail due to things like insufficient address space for all the device BARs even when they _are_ in the right slots. Especially if there are lots of slots, or bridges which can provide unlimited slots.
That is arcane: device-dependent, CPU-dependent, machine-dependent, RAM-size dependent (in a non-linear way), device-option-dependent and probably QEMU-version-dependent too.
It would be nice if libvirt (et al) would prevent the user from creating a VM with insufficient BAR space for that machine, but I'm not sure how to do it sanely, without arcane knowledge getting about.
Maybe that idea of a .so shared by qemu and libvirt, to manipulate device configurations, is a sane one after all.
-- Jamie
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 4 lines · Mark McLoughlin
Quoted 1 line
Worst case we hardcode those numbers (gasp, faint).
Maybe we can just add the open slots to the -help output. That'd be nice and clean.
Make them part of the machine configuration.
After all, they are part of the machine configuration, and ACPI, BIOS etc. need to know about all the machine slots anyway.
Having said that, I prefer the idea that slot allocation is handled either in Qemu, or in a separate utility called qemu-machine-config (for working with machine configs), or in a library libqemu-machine-config.so.
I particularly don't like the idea of arcane machine-dependent slot allocation knowledge living in libvirt, because it needs to be in Qemu anyway for non-libvirt users. No point in having two implementations of something tricky and likely to have machine quirks, if one will do.
-- Jamie
RE: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityHi all,
On real hardware, I usually do not care about PCI address - instead I use slot numbers. A standard main board has about 5 pci slots where you can plug in cards. So if a card is damaged, I usually say something like 'please replace the card in the first slot'.
Can't we simply define a 'slot to pci address' mapping for each platform? For example, we reserve some pci addresses for standard hardware like ide and scsi controller, and use the rest for the slot mapping:
pci addr 1 -> reserved
pci addr 2 -> reserved for ide
pci addr 3 -> reserved for scsi
pci addr 4 -> reserved for usb hub
...
pci addr 8 -> slot 7
pci addr 9 -> slot 6
pci addr 10 -> slot 5
pci addr 11 -> slot 4
pci addr 12 -> slot 3
pci addr 13 -> slot 2
pci addr 14 -> slot 1
pci addr 15 -> slot 0
The management application can then use those slot numbers to place a device into a specific bus position.
- net nic,model=e1000,slot=0
Or is that too inflexible?
- Dietmar
cover Change virtio blk/console PCI classes and introduce compat machine type [was Re: Configuration vs. compat hints]
In reply to Anthony LiguoriQuoted 5 lines · Anthony Liguori
2) Whenever the default machine type changes in a guest-visible way, introduce a new machine type
- Use explicit versions in name: pc-v1, pc-v2 or use more descriptive
names pc-with-usb
- Easily transitions to device config files
Okay, here's a small series of patches which changes the virtio block and console machine types and introduces a pc-0-10 machine type which uses the old PCI classes.
Cheers,
Mark.
PATCH 1/3 Change default PCI class of virtio-blk to PCI_CLASS_STORAGE_SCSI
Windows virtio driver cannot pass DTM (certification) tests while the storage class is PCI_CLASS_STORAGE_UNKNOWN.
A new qdev type is introduced to allow devices using the old class to be created for compatibility with qemu-0.10.x.
--- hw/virtio-pci.c | 20 +++++++++++++++++--- 1 files changed, 17 insertions(+), 3 deletions(-)
hw/virtio-pci.c +17 -3
@@ -414,7 +414,8 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,virtio_bind_device (vdev, &virtio_pci_bindings, proxy); } -static void virtio_blk_init_pci (PCIDevice *pci_dev) +static void virtio_blk_init_pci_with_class (PCIDevice *pci_dev, +uint16_t class_code) {VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev);VirtIODevice *vdev;
@@ -423,8 +424,17 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)virtio_init_pci (proxy, vdev,PCI_VENDOR_ID_REDHAT_QUMRANET ,PCI_DEVICE_ID_VIRTIO_BLOCK , -PCI_CLASS_STORAGE_OTHER , -0x00 ); + class_code,0x00 ); +} + +static void virtio_blk_init_pci (PCIDevice *pci_dev) +{ +virtio_blk_init_pci_with_class (pci_dev,PCI_CLASS_STORAGE_SCSI ); +} + +static void virtio_blk_init_pci_0_10 (PCIDevice *pci_dev) +{ +virtio_blk_init_pci_with_class (pci_dev,PCI_CLASS_STORAGE_OTHER ); }static void virtio_console_init_pci (PCIDevice *pci_dev)
@@ -476,6 +486,10 @@ static void virtio_pci_register_devices(void) virtio_console_init_pci);pci_qdev_register ("virtio-balloon-pci" ,sizeof (VirtIOPCIProxy), virtio_balloon_init_pci); + +/* For compatibility with 0.10 */ +pci_qdev_register ("virtio-blk-pci-0-10" ,sizeof (VirtIOPCIProxy), + virtio_blk_init_pci_0_10); }device_init (virtio_pci_register_devices)
Signature · 1 line
1.6.2.5
PATCH 2/3 Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER
We're using PCI_CLASS_DISPLAY_OTHER now, but qemu-kvm.git is using PCI_CLASS_OTHERS because:
"As a PCI_CLASS_DISPLAY_OTHER, it reduces primary display somehow on
Windows XP (possibly Windows disables acceleration since it fails to find a driver)."
While this is valid, many versions of X will get confused by it. Class major number of 0 gets treated as a possibly prehistoric VGA device, and then the autoconfig logic gets confused trying to figure out whether the virtio console or the pv vga device are the real VGA.
We should really set a proper class ID. 0x0780 (serial / other) seems most appropriate. This shouldn't require any kernel changes, the modalias for virtio looks like:
alias: pci:v00001AF4d*sv*sd*bc*sc*i*
so won't care what the base class or subclass are.
It shows up in the guest as:
00:05.0 Communication controller: Qumranet, Inc. Virtio console
A new qdev type is introduced to allow devices using the old class to be created for compatibility with qemu-0.10.x.
--- hw/pci_ids.h | 3 +++ hw/virtio-pci.c | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-)
hw/pci_ids.h +3 -0
@@ -35,6 +35,9 @@#define PCI_CLASS_BRIDGE_PCI 0x0604#define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_CLASS_SERIAL_OTHER 0x0780 + +#define PCI_CLASS_PROCESSOR_CO 0x0b40#define PCI_CLASS_COMMUNICATION_OTHER 0x0780#define PCI_CLASS_PROCESSOR_CO 0x0b40
hw/virtio-pci.c +15 -3
@@ -437,7 +437,8 @@ static void virtio_blk_init_pci_0_10(PCIDevice *pci_dev)virtio_blk_init_pci_with_class (pci_dev,PCI_CLASS_STORAGE_OTHER ); } -static void virtio_console_init_pci (PCIDevice *pci_dev) +static void virtio_console_init_pci_with_class (PCIDevice *pci_dev, +uint16_t class_code) {VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev);VirtIODevice *vdev;
@@ -446,8 +447,17 @@ static void virtio_console_init_pci(PCIDevice *pci_dev)virtio_init_pci (proxy, vdev,PCI_VENDOR_ID_REDHAT_QUMRANET ,PCI_DEVICE_ID_VIRTIO_CONSOLE , -PCI_CLASS_DISPLAY_OTHER , -0x00 ); + class_code,0x00 ); +} + +static void virtio_console_init_pci (PCIDevice *pci_dev) +{ +virtio_console_init_pci_with_class (pci_dev,PCI_CLASS_SERIAL_OTHER ); +} + +static void virtio_console_init_pci_0_10 (PCIDevice *pci_dev) +{ +virtio_console_init_pci_with_class (pci_dev,PCI_CLASS_DISPLAY_OTHER ); }static void virtio_net_init_pci (PCIDevice *pci_dev)
@@ -490,6 +500,8 @@ static void virtio_pci_register_devices(void)/* For compatibility with 0.10 */ pci_qdev_register ("virtio-blk-pci-0-10" ,sizeof (VirtIOPCIProxy), virtio_blk_init_pci_0_10); +pci_qdev_register ("virtio-console-pci-0-10" ,sizeof (VirtIOPCIProxy), + virtio_console_init_pci_0_10); }device_init (virtio_pci_register_devices)
Signature · 1 line
1.6.2.5
PATCH 3/3 Add a pc-0-10 machine type for compatibility with 0.10.x
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.
--- hw/pc.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-)
hw/pc.c +40 -6
@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)/* PC hardware initialisation */ static void pc_init1 (ram_addr_t ram_size,const char *boot_device, -const char *kernel_filename,const char *kernel_cmdline, +const char *kernel_filename, +const char *kernel_cmdline,const char *initrd_filename, -int pci_enabled,const char *cpu_model) +const char *cpu_model, +int pci_enabled, +int compat_0_10) {char *filename;int ret, linux_boot, i;
@@ -1104,6 +1107,7 @@ static void pc_init1(ram_addr_t ram_size,BlockDriverState *fd[MAX_FD ];int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;void *fw_cfg; +const char *virtio_blk_name, *virtio_console_name;if (ram_size >=0xe0000000 ) { above_4g_mem_size = ram_size -0xe0000000 ;
@@ -1394,13 +1398,21 @@ static void pc_init1(ram_addr_t ram_size, } } + virtio_blk_name ="virtio-blk-pci" ; + virtio_console_name ="virtio-console-pci" ; + +if (compat_0_10) { + virtio_blk_name ="virtio-blk-pci-0-10" ; + virtio_console_name ="virtio-console-pci-0-10" ; + } +/* Add virtio block devices */ if (pci_enabled) {int index;int unit_id =0 ;while ((index =drive_get_index (IF_VIRTIO ,0 , unit_id)) !=-1 ) { - pci_dev =pci_create ("virtio-blk-pci" , + pci_dev =pci_create (virtio_blk_name, drives_table[index].devaddr);qdev_init (&pci_dev->qdev); unit_id++;
@@ -1417,7 +1429,7 @@ static void pc_init1(ram_addr_t ram_size,if (pci_enabled) {for (i =0 ; i <MAX_VIRTIO_CONSOLES ; i++) {if (virtcon_hds[i]) { -pci_create_simple (pci_bus,-1 ,"virtio-console-pci" ); +pci_create_simple (pci_bus,-1 , virtio_console_name); } } }
@@ -1432,7 +1444,7 @@ static void pc_init_pci(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename,1 , cpu_model); + initrd_filename, cpu_model,1 ,0 ); } static void pc_init_isa(ram_addr_t ram_size,
@@ -1444,7 +1456,19 @@ static void pc_init_isa(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename,0 , cpu_model); + initrd_filename, cpu_model,0 ,0 ); +} + +static void pc_init_pci_0_10 (ram_addr_t ram_size, +const char *boot_device, +const char *kernel_filename, +const char *kernel_cmdline, +const char *initrd_filename, +const char *cpu_model) +{ +pc_init1 (ram_size, boot_device, + kernel_filename, kernel_cmdline, + initrd_filename, cpu_model,1 ,1 ); }/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1470,10 +1494,20 @@ static QEMUMachine isapc_machine = { .max_cpus = 1, }; +static QEMUMachine pc_0_10_machine = { + .name ="pc-0-10" , + .desc ="Standard PC compatibile with qemu 0.10.x" , + .init = pc_init_pci_0_10, + .max_cpus =255 , +}; +static void pc_machine_init (void ) {qemu_register_machine (&pc_machine);qemu_register_machine (&isapc_machine); + +/* For compatibility with 0.10.x */ +qemu_register_machine (&pc_0_10_machine); }machine_init (pc_machine_init);
Signature · 1 line
1.6.2.5
Re: [Qemu-devel] [PATCH 3/3] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 15 lines · Mark McLoughlin
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.
Signed-off-by Mark McLoughlin<[email protected]>--- hw/pc.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-)hw/pc.c +0
-0@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)/* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size,
hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1093
Quoted 10 lines
hw/pc.c +5
-2const char *boot_device, - const char *kernel_filename, const char *kernel_cmdline, + const char *kernel_filename, + const char *kernel_cmdline, const char *initrd_filename, - int pci_enabled, const char *cpu_model) + const char *cpu_model, + int pci_enabled, + int compat_0_10)
compat_level ( == COMPAT_DEFAULT, COMPAT_0_10 ).
hw/pc.c static QEMUMachine isapc_machine = { · line 1499
Quoted 4 lines
hw/pc.c +3
-0+static QEMUMachine pc_0_10_machine = { + .name ="pc-0-10" , + .desc ="Standard PC compatibile with qemu 0.10.x" ,
"compatible"
hw/pc.c static QEMUMachine isapc_machine = { · line 1501
Quoted 3 lines
hw/pc.c +2
-0+ .init = pc_init_pci_0_10, + .max_cpus = 255,
.compat_level = COMPAT_0_10,
Quoted 3 lines
hw/pc.c +2
-0+}; +
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 3/3] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 35 lines · Avi Kivity
Quoted 15 lines · Mark McLoughlin
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibilty with qemu-0.10.x.
Signed-off-by Mark McLoughlin<[email protected]>--- hw/pc.c | 46 ++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 40 insertions(+), 6 deletions(-)hw/pc.c +0
-0@@ -1084,9 +1084,12 @@ static CPUState *pc_new_cpu(const char *cpu_model)/* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size,hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1093
Quoted 10 lines
hw/pc.c +5
-2const char *boot_device, - const char *kernel_filename, const char *kernel_cmdline, + const char *kernel_filename, + const char *kernel_cmdline, const char *initrd_filename, - int pci_enabled, const char *cpu_model) + const char *cpu_model, + int pci_enabled, + int compat_0_10)
compat_level( ==COMPAT_DEFAULT,COMPAT_0_10).hw/pc.c static QEMUMachine isapc_machine = { · line 1499
Quoted 4 lines
hw/pc.c +3
-0+static QEMUMachine pc_0_10_machine = { + .name ="pc-0-10" , + .desc ="Standard PC compatibile with qemu 0.10.x" ,
Quoted 7 lines
"compatible"
hw/pc.c static QEMUMachine isapc_machine = { · line 1501
Quoted 3 lines
hw/pc.c +2
-0+ .init = pc_init_pci_0_10, + .max_cpus = 255,.compat_level =
COMPAT_0_10,
Yep, this would be nice.
To do it, I'd add a machine_compat_level enum member to QEMUMachine and pass a QEMUMachine pointer to QEMUMachineInitFunc.
Happy to do that, and fix up the >50 affected machine types, but before going to that bother I'd prefer to first get some indication that the general approach would be accepted :-)
Following up with a slightly better patch, but still confined to hw/pc.c
Cheers,
Mark.
PATCH v2 3/3 Add a pc-0-10 machine type for compatibility with 0.10.x
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.
--- hw/pc.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 53 insertions(+), 6 deletions(-)
hw/pc.c +53 -6
@@ -1081,12 +1081,20 @@ static CPUState *pc_new_cpu(const char *cpu_model)return env; } +enum { +COMPAT_DEFAULT =0 , +COMPAT_0_10 ,/* compatible with qemu 0.10.x */ +}; +/* PC hardware initialisation */ static void pc_init1 (ram_addr_t ram_size,const char *boot_device, -const char *kernel_filename,const char *kernel_cmdline, +const char *kernel_filename, +const char *kernel_cmdline,const char *initrd_filename, -int pci_enabled,const char *cpu_model) +const char *cpu_model, +int pci_enabled, +int compat_level) {char *filename;int ret, linux_boot, i;
@@ -1104,6 +1112,7 @@ static void pc_init1(ram_addr_t ram_size,BlockDriverState *fd[MAX_FD ];int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;void *fw_cfg; +const char *virtio_blk_name, *virtio_console_name;if (ram_size >=0xe0000000 ) { above_4g_mem_size = ram_size -0xe0000000 ;
@@ -1394,13 +1403,26 @@ static void pc_init1(ram_addr_t ram_size, } } +switch (compat_level) { +case COMPAT_DEFAULT : +default : + virtio_blk_name ="virtio-blk-pci" ; + virtio_console_name ="virtio-console-pci" ; +break ; + +case COMPAT_0_10 : + virtio_blk_name ="virtio-blk-pci-0-10" ; + virtio_console_name ="virtio-console-pci-0-10" ; +break ; + } +/* Add virtio block devices */ if (pci_enabled) {int index;int unit_id =0 ;while ((index =drive_get_index (IF_VIRTIO ,0 , unit_id)) !=-1 ) { - pci_dev =pci_create ("virtio-blk-pci" , + pci_dev =pci_create (virtio_blk_name, drives_table[index].devaddr);qdev_init (&pci_dev->qdev); unit_id++;
@@ -1417,7 +1439,7 @@ static void pc_init1(ram_addr_t ram_size,if (pci_enabled) {for (i =0 ; i <MAX_VIRTIO_CONSOLES ; i++) {if (virtcon_hds[i]) { -pci_create_simple (pci_bus,-1 ,"virtio-console-pci" ); +pci_create_simple (pci_bus,-1 , virtio_console_name); } } }
@@ -1432,7 +1454,8 @@ static void pc_init_pci(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename,1 , cpu_model); + initrd_filename, cpu_model, +1 ,COMPAT_DEFAULT ); } static void pc_init_isa(ram_addr_t ram_size,
@@ -1444,7 +1467,21 @@ static void pc_init_isa(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename,0 , cpu_model); + initrd_filename, cpu_model, +0 ,COMPAT_DEFAULT ); +} + +static void pc_init_pci_0_10 (ram_addr_t ram_size, +const char *boot_device, +const char *kernel_filename, +const char *kernel_cmdline, +const char *initrd_filename, +const char *cpu_model) +{ +pc_init1 (ram_size, boot_device, + kernel_filename, kernel_cmdline, + initrd_filename, cpu_model, +1 ,COMPAT_0_10 ); }/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1470,10 +1507,20 @@ static QEMUMachine isapc_machine = { .max_cpus = 1, }; +static QEMUMachine pc_0_10_machine = { + .name ="pc-0-10" , + .desc ="Standard PC compatible with qemu 0.10.x" , + .init = pc_init_pci_0_10, + .max_cpus =255 , +}; +static void pc_machine_init (void ) {qemu_register_machine (&pc_machine);qemu_register_machine (&isapc_machine); + +/* For compatibility with 0.10.x */ +qemu_register_machine (&pc_0_10_machine); }machine_init (pc_machine_init);
Signature · 1 line
1.6.2.5
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087
Quoted 7 lines · Mark McLoughlin
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.
hw/pc.c +4
-0+enum { +COMPAT_DEFAULT =0 , +COMPAT_0_10 ,/* compatible with qemu 0.10.x */ +};
Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.
Maybe better add a global '-compat' switch and a global compat enum where every driver can just look at?
Another question: Is migrating from 0.11 in 0.10-compat mode to 0.10 supposed to work? If so we make virtio-net better turn off msi then.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 10 lines · Gerd Hoffmann
hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087
Quoted 7 lines · Mark McLoughlin
Add a pc-0-10 machine type to allow a pc machine to be created with virtio block and console devices compatibility with qemu-0.10.x.
hw/pc.c +4
-0+enum { +COMPAT_DEFAULT =0 , +COMPAT_0_10 ,/* compatible with qemu 0.10.x */ +};Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.
No, it's right. A machine type is nothing more than a default device tree. If we want to change what the default device tree is and wish to maintain compatibility, we need to introduce a new device tree so that the old one can be still accessed.
So basically, if we had device config files, it would look like:
/usr/share/qemu/configs/pc-0-10.dts /usr/share/qemu/configs/pc-0-11.dts /usr/share/qemu/configs/pc -> /usr/share/qemu/configs/pc-0-11.dts
For other board types, they would also need to version their device trees too.
Quoted 1 line
Another question: Is migrating from 0.11 in 0.10-compat mode to 0.10 supposed to work? If so we make virtio-net better turn off msi then.
If you mean live migration, no. However, live migration from 0.10 to 0.11 in 0.10-compat mode should work.
But from the guest perspective, 0.10-compat mode should look identical to 0.10 which means we do want to turn off msi.
Regards,
Anthony Liguori
Quoted 5 lines
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann
hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087
Quoted 4 lines
hw/pc.c +4
-0+enum { +COMPAT_DEFAULT =0 , +COMPAT_0_10 ,/* compatible with qemu 0.10.x */ +};Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.
Quoted 2 lines
No, it's right. A machine type is nothing more than a default device tree.
Plain "-M pc" has no virtio blk device.
Quoted 5 lines
So basically, if we had device config files, it would look like:
/usr/share/qemu/configs/pc-0-10.dts/usr/share/qemu/configs/pc-0-11.dts/usr/share/qemu/configs/pc->/usr/share/qemu/configs/pc-0-11.dts
Doesn't work. Your virtio blk device isn't in there.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 16 lines · Gerd Hoffmann
Quoted 10 lines · Anthony Liguori
Quoted 8 lines · Gerd Hoffmann
hw/pc.c static CPUState *pc_new_cpu(const char *cpu_model) · line 1087
Quoted 4 lines
hw/pc.c +4
-0+enum { +COMPAT_DEFAULT =0 , +COMPAT_0_10 ,/* compatible with qemu 0.10.x */ +};Hmm. Just digged in the virtio blk code. Noticed some ppc machines have virtio block devices too. So linking it to a machine type looks wrong to me.
Quoted 2 lines
No, it's right. A machine type is nothing more than a default device tree.
Plain "-M pc" has no virtio blk device.
Quoted 7 lines
Quoted 5 lines
So basically, if we had device config files, it would look like:
/usr/share/qemu/configs/pc-0-10.dts/usr/share/qemu/configs/pc-0-11.dts/usr/share/qemu/configs/pc->/usr/share/qemu/configs/pc-0-11.dtsDoesn't work. Your virtio blk device isn't in there.
Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines · Gerd Hoffmann
Quoted 3 lines
/usr/share/qemu/configs/pc-0-10.dts/usr/share/qemu/configs/pc-0-11.dts/usr/share/qemu/configs/pc->/usr/share/qemu/configs/pc-0-11.dtsDoesn't work. Your virtio blk device isn't in there.
Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.
Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at.
We have different versions of devices. We should model them that way. I'd start with a global compat_level. We might switch to a per-device compat level later if there is a need. With qdev it should be easy once the devices are converted. I think it will be much more better maintainable than adding new devices because there is a standardized way to switch a driver to an older version instead of having to know "oh, that driver has these compat versions, but this one hasn't".
virtio blk+console will switch class for compat_level < 0.11. virtio net will disable msi for compat_level < 0.11. ide might adapt the firmware version for the virtual disk/cdrom to the compat level. Everybody else is free to ignore it.
Note that different machine config versions might make sense nevertheless in case the set of (default) devices changes. i.e. if we turn on usb by default we might add a compat machine type without usb.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 5 lines · Gerd Hoffmann
Quoted 4 lines · Mark McLoughlin
Quoted 3 lines · Gerd Hoffmann
Quoted 3 lines
/usr/share/qemu/configs/pc-0-10.dts/usr/share/qemu/configs/pc-0-11.dts/usr/share/qemu/configs/pc->/usr/share/qemu/configs/pc-0-11.dts
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
Doesn't work. Your virtio blk device isn't in there.
Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.
Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at. We have different versions of devices.
We have options that we can tweak for devices. That doesn't mean they're versioned. What the default set of options that is turned on for any given device is determined by the machine type (since the machine init is what creates the devices to start with).
Linear versioning doesn't work because there are too many forks of QEMU (each distro release that includes backported features is a fork).
Regards.
Anthony Liguori
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 12 lines · Anthony Liguori
Quoted 11 lines · Gerd Hoffmann
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines · Gerd Hoffmann
Quoted 3 lines
/usr/share/qemu/configs/pc-0-10.dts/usr/share/qemu/configs/pc-0-11.dts/usr/share/qemu/configs/pc->/usr/share/qemu/configs/pc-0-11.dtsDoesn't work. Your virtio blk device isn't in there.
Right - I had assumed Anthony meant that such a config file would also have details on the defaults used for devices which can be added to that machine.
Quoted 8 lines
Quoted 3 lines
Could probably be done that way, but that wouldn't be different from a global compat variable where the virtio-block-pci driver looks at. We have different versions of devices.
We have options that we can tweak for devices. That doesn't mean they're versioned. What the default set of options that is turned on for any given device is determined by the machine type (since the machine init is what creates the devices to start with).
The machine init doesn't create all devices. USB devices are created outside machine init today, and that will become more and more common.
I expect long-term we will end up with one of these two models:
(1) - machine init creates just the bare devices, i.e. what is there when you specify just '-M pc'. Either hardcoded or from machine config file.
- generic code adds devices added by cmd line switches.
(2) - command line switches insert additional devices into the bare (-M pc) device tree.
- The virtual machine is created from that modified device tree.
I both cases it is not clear how the machine init / machine config will handle the versioning of the devices added by command line switches.
We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:
virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).
pc-0.10 could then register a list of default properties, i.e. something like
"virtio-blk-pci" => "class=0x??"
"virtio-console-pci" => "class=0x??"
"virtio-net-pci => "msi=0"
"ide-disk" => "fw-version=0.10.0"
When creating devices qdev would apply them.
I can prototype that.
comments?
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 17 lines · Gerd Hoffmann
We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:
virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).
pc-0.10 could then register a list of default properties, i.e. something
like"virtio-blk-pci" => "class=0x??" "virtio-console-pci" => "class=0x??" "virtio-net-pci => "msi=0" "ide-disk" => "fw-version=0.10.0"
Quoted 5 lines
When creating devices qdev would apply them.
I can prototype that.
comments?
I think this would be a very nice way of making what I did more generic, but with the same external interface.
Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.
If we're settled on adding '-M pc-0-10', I next want to:
1) add '-M pc-0-11' and make it the default
2) make '-M pc' a symlink to the latest machine type
i.e. 'qemu-system-x86_64 -M ?' would give:
Supported machines are:
pc Standard PC with latest features pc-0-11 Standard PC compatible with qemu 0.11.x (default) pc-0-10 Standard PC compatible with qemu 0.10.x isapc ISA-only PC
and libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:
<os>
<type arch='x86_64' machine='pc-0-11'>hvm</type>
</os>
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 46 lines · Mark McLoughlin
Quoted 17 lines · Gerd Hoffmann
We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:
virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).
pc-0.10 could then register a list of default properties, i.e. something
like"virtio-blk-pci" => "class=0x??" "virtio-console-pci" => "class=0x??" "virtio-net-pci => "msi=0" "ide-disk" => "fw-version=0.10.0"Quoted 6 lines
When creating devices qdev would apply them.
I can prototype that.
comments?
I think this would be a very nice way of making what I did more generic, but with the same external interface.
Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.
If we're settled on adding '-M pc-0-10', I next want to:
1) add '-M pc-0-11' and make it the default
2) make '-M pc' a symlink to the latest machine type
i.e. 'qemu-system-x86_64 -M ?' would give:
Supported machines are:
pc Standard PC with latest features pc-0-11 Standard PC compatible with qemu 0.11.x (default) pc-0-10 Standard PC compatible with qemu 0.10.x isapc ISA-only PC
Quoted 8 lines
and libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:
<os> <type arch='x86_64' machine='pc-0-11'>hvm</type> </os>
Looks good. But why 0-11 and not 0.11?
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 50 lines · Avi Kivity
Quoted 49 lines · Mark McLoughlin
Quoted 17 lines · Gerd Hoffmann
We could have each machine type register a list of default options. Using qdev properties that should be doable in a fairly generic way, like this:
virtio-blk-pci and virtio-console-pci get a "class" property. virtio-net-pci gets a "msi" property. ide-disk+cdrom gets a "fw-version" property (well, not yet, when being converted to qdev).
pc-0.10 could then register a list of default properties, i.e. something
like"virtio-blk-pci" => "class=0x??" "virtio-console-pci" => "class=0x??" "virtio-net-pci => "msi=0" "ide-disk" => "fw-version=0.10.0"Quoted 6 lines
When creating devices qdev would apply them.
I can prototype that.
comments?
I think this would be a very nice way of making what I did more generic, but with the same external interface.
Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.
If we're settled on adding '-M pc-0-10', I next want to:
1) add '-M pc-0-11' and make it the default
2) make '-M pc' a symlink to the latest machine type
i.e. 'qemu-system-x86_64 -M ?' would give:
Supported machines are:
pc Standard PC with latest features pc-0-11 Standard PC compatible with qemu 0.11.x (default) pc-0-10 Standard PC compatible with qemu 0.10.x isapc ISA-only PCand libvirt, when creating a guest for the first time would parse this output for the default value and store it in the XML config:
Quoted 7 lines
Quoted 5 lines
<os> <type arch='x86_64' machine='pc-0-11'>hvm</type> </os>Looks good. But why 0-11 and not 0.11?
I really wanted to use an underscore, but I thought a hyphen was a good compromise.
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 7 lines · Mark McLoughlin
Quoted 2 lines
Looks good. But why 0-11 and not 0.11?
I really wanted to use an underscore, but I thought a hyphen was a good compromise.
A period is really a very short underscore.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Mark McLoughlinQuoted 7 lines
Quoted 1 line
comments?
I think this would be a very nice way of making what I did more generic, but with the same external interface.
Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.
I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.
Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Hi,
Quoted 3 lines
I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.
To back that with some code here is a quick patch. Not splitted up yet.
Only virtio-blk is handled for demonstration purposes.
Will not apply cleanly as it depends on both posted and not-yet posted patches in my patch queue. Once my qdev properties patch is in it should be easy to rebase to upstream/master though.
cheers,
Gerd
hw/boards.h +1 -0
@@ -17,6 +17,7 @@ typedef struct QEMUMachine {int use_scsi;int max_cpus;int is_default; +struct CompatProperty *compat_props;struct QEMUMachine *next; } QEMUMachine;
hw/pc.c +16 -0
@@ -1460,6 +1460,21 @@ static QEMUMachine pc_machine = { .is_default = 1, }; +static QEMUMachine pc_machine_v0_10 = { + .name ="pc-0.10" , + .desc ="Standard PC, qemu 0.10" , + .init = pc_init_pci, + .max_cpus =255 , + .compat_props = (CompatProperty []) { + { + .driver ="virtio-blk-pci" , + .property ="class" , + .value ="0x0180" ,/* PCI_CLASS_STORAGE_OTHER */ + }, + {/* end of list */ } + }, +}; +static QEMUMachine isapc_machine = { .name ="isapc" , .desc ="ISA-only PC" ,
@@ -1470,6 +1485,7 @@ static QEMUMachine isapc_machine = {static void pc_machine_init (void ) {qemu_register_machine (&pc_machine); +qemu_register_machine (&pc_machine_v0_10);qemu_register_machine (&isapc_machine); }
hw/qdev-properties.c +19 -0
@@ -228,3 +228,22 @@ void qdev_prop_set_defaults(DeviceState *dev, Property *props) } } +static CompatProperty *compat_props; + +void qdev_register_compat_props (CompatProperty *props) +{ + compat_props = props; +} + +void qdev_prop_set_compat (DeviceState *dev) +{ +CompatProperty *prop; + +if (!compat_props) +return ; +for (prop = compat_props; prop->driver !=NULL ; prop++) { +if (strcmp (dev->info->name, prop->driver) !=0 ) +continue ; +qdev_prop_parse (dev, prop->property, prop->value); + } +}
hw/qdev.c +1 -0
@@ -130,6 +130,7 @@ DeviceState *qdev_create(BusState *bus, const char *name) dev->parent_bus = bus;qdev_prop_set_defaults (dev, dev->info->props);qdev_prop_set_defaults (dev, dev->parent_bus->info->props); +qdev_prop_set_compat (dev);LIST_INSERT_HEAD (&bus->children, dev, sibling);return dev; }
hw/qdev.h +11 -0
@@ -8,6 +8,8 @@ typedef struct Property Property;typedef struct PropertyInfo PropertyInfo ; +typedef struct CompatProperty CompatProperty ; +typedef struct DeviceInfo DeviceInfo ;typedef struct BusState BusState ;
@@ -63,6 +65,12 @@ struct PropertyInfo {int (*print)(DeviceState *dev,Property *prop,char *dest,size_t len); }; +struct CompatProperty { +const char *driver; +const char *property; +const char *value; +}; +/*** Board API. This should go away once we have a machine config file. ***/ DeviceState *qdev_create (BusState *bus,const char *name);
@@ -152,4 +160,7 @@ int qdev_prop_set_uint32(DeviceState *dev, const char *name, uint32_t value);int qdev_prop_set_ptr (DeviceState *dev,const char *name,void *value);void qdev_prop_set_defaults (DeviceState *dev,Property *props); +void qdev_register_compat_props (CompatProperty *props); +void qdev_prop_set_compat (DeviceState *dev); +#endif
hw/virtio-pci.c +10 -8
@@ -87,12 +87,7 @@ typedef struct {VirtIODevice *vdev;uint32_t addr; -uint16_t vendor; -uint16_t device; -uint16_t subvendor; -uint16_t class_code; -uint8_t pif; - +uint32_t class_code;qname hostlink; } VirtIOPCIProxy;
@@ -421,12 +416,15 @@ static void virtio_blk_init_pci(PCIDevice *pci_dev)VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev);VirtIODevice *vdev; +if (proxy->class_code !=PCI_CLASS_STORAGE_SCSI && + proxy->class_code !=PCI_CLASS_STORAGE_OTHER ) + proxy->class_code =PCI_CLASS_STORAGE_SCSI ; + vdev =virtio_blk_init (&pci_dev->qdev, proxy->hostlink);virtio_init_pci (proxy, vdev,PCI_VENDOR_ID_REDHAT_QUMRANET ,PCI_DEVICE_ID_VIRTIO_BLOCK , -PCI_CLASS_STORAGE_OTHER , -0x00 ); + proxy->class_code,0x00 ); }static void virtio_console_init_pci (PCIDevice *pci_dev)
@@ -478,6 +476,10 @@ static PCIDeviceInfo virtio_info[] = { .name = "drive", .info = &qdev_prop_name, .offset = offsetof(VirtIOPCIProxy, hostlink), + },{ + .name = "class", + .info = &qdev_prop_hex32, + .offset = offsetof(VirtIOPCIProxy, class_code), }, {/* end of list */ } },
vl.c +2 -0
@@ -6030,6 +6030,8 @@ int main(int argc, char **argv, char **envp)module_call_init (MODULE_INIT_DEVICE ); +if (machine->compat_props) +qdev_register_compat_props (machine->compat_props); machine->init (ram_size, boot_devices, kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 2 lines · Gerd Hoffmann
I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place.
Ah, I see why ... with your -device stuff, these new devices types would become part of the public interface.
If they were to be public, we'd probably want them to become virtio-$type-pci-$feature instead. As pointed out before, that becomes cumbersome.
Quoted 12 lines
hw/pc.c +4
-0@@ -1460,6 +1460,21 @@ static QEMUMachine pc_machine = { .is_default = 1, }; +static QEMUMachine pc_machine_v0_10 = { + .name ="pc-0.10" , + .desc ="Standard PC, qemu 0.10" , + .init = pc_init_pci,
hw/pc.c static QEMUMachine pc_machine = { · line 1476
Quoted 10 lines
hw/pc.c +10
-0+ .max_cpus = 255, + .compat_props = (CompatProperty []) { + { + .driver ="virtio-blk-pci" , + .property ="class" , + .value ="0x0180" ,/* PCI_CLASS_STORAGE_OTHER */ + }, + {/* end of list */ } + }, +};
I did actually experiment with something similar to this, but backed off because I didn't like putting such details (i.e. the class value) in hw/pc.c rather than keeping them self contained in the driver code. Especially since it'll have to be replicated for every machine which can use the device.
Hmm, if this was a machine config file, would be do something like "include compat-props-0.10.conf"? Maybe something similar is in order here?
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 12 lines · Mark McLoughlin
Quoted 12 lines
hw/pc.c +12
-0+static QEMUMachine pc_machine_v0_10 = { + .name ="pc-0.10" , + .desc ="Standard PC, qemu 0.10" , + .init = pc_init_pci, + .max_cpus =255 , + .compat_props = (CompatProperty []) { + { + .driver ="virtio-blk-pci" , + .property ="class" , + .value ="0x0180" ,/* PCI_CLASS_STORAGE_OTHER */ + }, + {/* end of list */ }
Quoted 8 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ }, +};I did actually experiment with something similar to this, but backed off because I didn't like putting such details (i.e. the class value) in
hw/pc.crather than keeping them self contained in the driver code. Especially since it'll have to be replicated for every machine which can use the device.
We don't need to have the list inline. We can have
CompatProperty compat_qemu_0_10[] {
[ properties here ]
};
somewhere and then just reference it like this:
static QEMUMachine pc_machine_v0_10 = {
.name = "pc-0.10",
[ ... ]
.compat_props = &compat_qemu_0_10,
};from multiple machine types.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Gerd HoffmannQuoted 9 lines · Gerd Hoffmann
Hi,
Quoted 3 lines
I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.
To back that with some code here is a quick patch. Not splitted up yet. Only virtio-blk is handled for demonstration purposes.
Will not apply cleanly as it depends on both posted and not-yet posted patches in my patch queue. Once my qdev properties patch is in it should be easy to rebase to upstream/master though.
It came out looking pretty good. The literal syntax is new to me:
+ .compat_props = (CompatProperty[]) {
+ {
I assume this is a GCC-ism?
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 6 lines · Anthony Liguori
It came out looking pretty good. The literal syntax is new to me:
+ .compat_props = (CompatProperty[]) {
+ {I assume this is a GCC-ism?
Not sure. Could also be C99. It is new to me too.
One of Pauls patches brought it in (check hw/syborg_timer.c, pretty close to the bottom). I found it very useful for building up static data structures and picked it up.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Anthony LiguoriQuoted 6 lines
It came out looking pretty good. The literal syntax is new to me:
hw/pc.c +2
-0+ .compat_props = (CompatProperty[]) { + {I assume this is a GCC-ism?
Compound literals ("(Foo[]){...}") are a standard C99 feature, as are designated initializers (".foo = ...")
Paul
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Gerd HoffmannQuoted 3 lines · Gerd Hoffmann
Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...
I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.
I have a similar 'next' branch in qemu-kvm.git.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 8 lines · Avi Kivity
Quoted 3 lines · Gerd Hoffmann
Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now. There are lots of patches on the list unprocessed, ranging from simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...
I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.
I have a similar 'next' branch in qemu-kvm.git.
Do you frequently rebase next? I was afraid that people would not be able to cope with a branch that rebased all of the time.
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
Quoted 6 lines · Anthony Liguori
Quoted 3 lines
I just found out about this queue. Can you make it a branch in qemu.git instead of some random repository? You could name it 'next' or 'next/aliguori' or something. That means a single git fetch brings both commits and queued patches.
I have a similar 'next' branch in qemu-kvm.git.
Do you frequently rebase next?
'next' is a throwaway branch. It's subject to change without notice.
Quoted 1 line
I was afraid that people would not be able to cope with a branch that rebased all of the time.
It's a way to see what you're thinking; no one should base a long running branch on it. I think it's fairly safe to do, people who are likely to create long running branches will be fairly knowledgable about the processes we use.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Gerd HoffmannQuoted 11 lines · Gerd Hoffmann
Quoted 7 lines
Quoted 1 line
comments?
I think this would be a very nice way of making what I did more generic, but with the same external interface.
Time is running short for 0.11, though, so I'd suggest it could be an incremental cleanup on top of the patches I posted.
I'd prefer to not introduce those virtio-$type-pci-$version devices in the first place. It isn't hard to write up something qdev based. Only problem is it will depend on lots of not-yet merged qdev patches.
Speaking of patches: What is up there? aliguori-queue.git wasn't flushed for more than a week now.
Holiday + sudden non-QEMU work items. I'm trying to block off some time this afternoon but this has been a tough week for me.
Quoted 2 lines
There are lots of patches on the list unprocessed, ranging from
simple one-liner build fixes to larger patch series. There was rumor on a new -stable release Tue/Wed this week which didn't happen yet. Looks like patch processing needs load-balancing to more people ...
It's not so easy to just distribute commit access to loads of people. However, we still have a pretty low patch acceptance rate so peer review + testing would certainly help reduce the overall patch traffic.
So I'd encourage folks to take some time and review/test patches on the list. For those that already do, it's greatly appreciated.
Regards,
Anthony Liguori
cover Add pc-0.11 machine type and make pc an alias to it
In reply to Mark McLoughlinHi,
Here's a series of small patches to finish off the machine type
compat work for 0.11.
The idea is that the likes of libvirt can canonicalize the 'pc'
machine type to the current latest version of the pc machine type and retain that in the VM configuration. That allows users to easily continue running their VMs with the same machine type with which they were originally created.
Thanks,
Mark.
PATCH 1/4 Remove the pc-0-10 machine type
In reply to Mark McLoughlinWe have the pc-0.10 machine type now which does exactly the same thing.
--- hw/pc.c | 55 +++++-------------------------------------------------- 1 files changed, 5 insertions(+), 50 deletions(-)
hw/pc.c +5 -50
@@ -1100,11 +1100,6 @@ static CPUState *pc_new_cpu(const char *cpu_model)return env; } -enum { -COMPAT_DEFAULT =0 , -COMPAT_0_10 ,/* compatible with qemu 0.10.x */ -}; -/* PC hardware initialisation */ static void pc_init1(ram_addr_t ram_size, const char *boot_device,
@@ -1112,8 +1107,7 @@ static void pc_init1(ram_addr_t ram_size,const char *kernel_cmdline, const char *initrd_filename, const char *cpu_model, - int pci_enabled, - int compat_level) + int pci_enabled) { char *filename;int ret, linux_boot, i;
@@ -1131,7 +1125,6 @@ static void pc_init1(ram_addr_t ram_size,BlockDriverState *fd[MAX_FD ];int using_vga = cirrus_vga_enabled || std_vga_enabled || vmsvga_enabled;void *fw_cfg; -const char *virtio_blk_name, *virtio_console_name;if (ram_size >=0xe0000000 ) { above_4g_mem_size = ram_size -0xe0000000 ;
@@ -1422,26 +1415,13 @@ static void pc_init1(ram_addr_t ram_size, } } -switch (compat_level) { -case COMPAT_DEFAULT : -default : - virtio_blk_name ="virtio-blk-pci" ; - virtio_console_name ="virtio-console-pci" ; -break ; - -case COMPAT_0_10 : - virtio_blk_name ="virtio-blk-pci-0-10" ; - virtio_console_name ="virtio-console-pci-0-10" ; -break ; - } -/* Add virtio block devices */ if (pci_enabled) {int index;int unit_id =0 ;while ((index =drive_get_index (IF_VIRTIO ,0 , unit_id)) !=-1 ) { - pci_dev =pci_create (virtio_blk_name, + pci_dev =pci_create ("virtio-blk-pci" , drives_table[index].devaddr);qdev_init (&pci_dev->qdev); unit_id++;
@@ -1458,7 +1438,7 @@ static void pc_init1(ram_addr_t ram_size,if (pci_enabled) {for (i =0 ; i <MAX_VIRTIO_CONSOLES ; i++) {if (virtcon_hds[i]) { -pci_create_simple (pci_bus,-1 , virtio_console_name); +pci_create_simple (pci_bus,-1 ,"virtio-console-pci" ); } } }
@@ -1473,8 +1453,7 @@ static void pc_init_pci(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename, cpu_model, -1 ,COMPAT_DEFAULT ); + initrd_filename, cpu_model,1 ); } static void pc_init_isa(ram_addr_t ram_size,
@@ -1486,21 +1465,7 @@ static void pc_init_isa(ram_addr_t ram_size, {pc_init1 (ram_size, boot_device, kernel_filename, kernel_cmdline, - initrd_filename, cpu_model, -0 ,COMPAT_DEFAULT ); -} - -static void pc_init_pci_0_10 (ram_addr_t ram_size, -const char *boot_device, -const char *kernel_filename, -const char *kernel_cmdline, -const char *initrd_filename, -const char *cpu_model) -{ -pc_init1 (ram_size, boot_device, - kernel_filename, kernel_cmdline, - initrd_filename, cpu_model, -1 ,COMPAT_0_10 ); + initrd_filename, cpu_model,0 ); }/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
@@ -1549,21 +1514,11 @@ static QEMUMachine isapc_machine = { .max_cpus = 1, }; -static QEMUMachine pc_0_10_machine = { - .name ="pc-0-10" , - .desc ="Standard PC compatible with qemu 0.10.x" , - .init = pc_init_pci_0_10, - .max_cpus =255 , -}; -static void pc_machine_init (void ) {qemu_register_machine (&pc_machine);qemu_register_machine (&pc_machine_v0_10);qemu_register_machine (&isapc_machine); - -/* For compatibility with 0.10.x */ -qemu_register_machine (&pc_0_10_machine); }machine_init (pc_machine_init);
Signature · 1 line
1.6.2.5
Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type
Quoted 2 lines · Mark McLoughlin
We have the pc-0.10 machine type now which does exactly the same thing.
Ah, I see Gerd fixed this already.
My other three patches should apply on top of his.
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type
Quoted 10 lines · Mark McLoughlin
Quoted 3 lines · Mark McLoughlin
We have the pc-0.10 machine type now which does exactly the same thing.
Ah, I see Gerd fixed this already.
My other three patches should apply on top of his.
Three or two? Can you take a closer look?
I tried earlier to drop the obvious ones but it didn't apply easily
Regards,
Anthony Liguori
Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type
Quoted 10 lines · Anthony Liguori
Quoted 7 lines · Mark McLoughlin
Quoted 2 lines · Mark McLoughlin
We have the pc-0.10 machine type now which does exactly the same thing.
Ah, I see Gerd fixed this already.
My other three patches should apply on top of his.
Three or two? Can you take a closer look?
Isn't going to work. I'd suggest to kick out my patch and take Mark's complete series instead. It does all my patch did, cleans up a bit more in virtio-pci.c (leading to conflicts) and adds the aliasing.
cheers,
Gerd
Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type
Quoted 8 lines · Gerd Hoffmann
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
Quoted 2 lines · Mark McLoughlin
We have the pc-0.10 machine type now which does exactly the same thing.
Ah, I see Gerd fixed this already.
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
My other three patches should apply on top of his.
Three or two? Can you take a closer look?
Isn't going to work. I'd suggest to kick out my patch and take Mark's complete series instead. It does all my patch did, cleans up a bit more in
virtio-pci.c(leading to conflicts) and adds the aliasing.
Heh :-)
Either way is fine - the only difference between with Gerd's patch with the two I just posted and the original four is a small cleanup in virtio-pci.c
Cheers,
Mark.
Re: [Qemu-devel] [PATCH 1/4] Remove the pc-0-10 machine type
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
Quoted 3 lines · Mark McLoughlin
We have the pc-0.10 machine type now which does exactly the same thing.
Quoted 8 lines
Quoted 4 lines
Ah, I see Gerd fixed this already.
My other three patches should apply on top of his.
Three or two? Can you take a closer look?
I tried earlier to drop the obvious ones but it didn't apply easily
You're right, Gerd's patch also removes the -0-10 devices, which is what my 2/4 patch did.
I'll re-send the two just to be clear.
Again, I think these two make sense to apply to both stable-0.11 and master.
Thanks,
Mark.
PATCH 1/2 Add machine type aliases
Add an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix.
Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future.
This is intended to mimic a symlink to a machine description file.
--- hw/boards.h | 1 + vl.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
hw/boards.h +1 -0
@@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size, typedef struct QEMUMachine { const char *name; + const char *alias; const char *desc; QEMUMachineInitFunc *init; int use_scsi;
vl.c +5 -0
@@ -3357,6 +3357,8 @@ static QEMUMachine *find_machine(const char *name)for (m = first_machine; m !=NULL ; m = m->next) {if (!strcmp (m->name, name))return m; +if (m->alias && !strcmp (m->alias, name)) +return m; }return NULL ; }
@@ -4993,6 +4995,9 @@ int main(int argc, char **argv, char **envp)QEMUMachine *m;printf ("Supported machines are:\n" );for (m = first_machine; m !=NULL ; m = m->next) { +if (m->alias) +printf ("%-10s %s (alias of %s)\n" , + m->alias, m->desc, m->name);printf ("%-10s %s%s\n" , m->name, m->desc, m->is_default ?" (default)" :"" );
Signature · 1 line
1.6.2.5
PATCH 2/2 Add a pc-0.11 machine type and make the pc type an alias
In reply to Mark McLoughlinThe pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.
Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.
--- hw/pc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/pc.c +2 -1
@@ -1512,7 +1512,8 @@ void cmos_set_s3_resume(void) }static QEMUMachine pc_machine = { - .name ="pc" , + .name ="pc-0.11" , + .alias ="pc" , .desc ="Standard PC" , .init = pc_init_pci, .max_cpus =255 ,
Signature · 1 line
1.6.2.5
Re: [Qemu-devel] [PATCH 2/2] Add a pc-0.11 machine type and make the pc type an alias
Hey,
Quoted 6 lines · Mark McLoughlin
The pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.
Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.
By the way, I think it would make sense to pull this into stable-0.11 before the 0.11 release.
It's a fairly minor code change which means users can start using the pc-0.11 machine type now so that, without doing anything in future, they can avoid compat issues when they update to qemu-0.12.
Cheers,
Mark.
PATCH 2/4 Remove the virtio-{blk, console}-pci-0-10 device types
In reply to Mark McLoughlinThese are now unused.
However, perhaps the idea is that when we add -device, they will be useful? In that case, we should add virtio-net-pci-0-10 too.
--- hw/virtio-pci.c | 57 ++++++++++-------------------------------------------- 1 files changed, 11 insertions(+), 46 deletions(-)
hw/virtio-pci.c +11 -46
@@ -423,63 +423,37 @@ static void virtio_init_pci(VirtIOPCIProxy *proxy, VirtIODevice *vdev,virtio_bind_device (vdev, &virtio_pci_bindings, proxy); } -static void virtio_blk_init_pci_with_class (PCIDevice *pci_dev, -uint16_t class_code) +static void virtio_blk_init_pci (PCIDevice *pci_dev) {VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev);VirtIODevice *vdev; - vdev =virtio_blk_init (&pci_dev->qdev); -virtio_init_pci (proxy, vdev, -PCI_VENDOR_ID_REDHAT_QUMRANET , -PCI_DEVICE_ID_VIRTIO_BLOCK , - class_code,0x00 ); -} - -static void virtio_blk_init_pci (PCIDevice *pci_dev) -{ -VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev); -if (proxy->class_code !=PCI_CLASS_STORAGE_SCSI && proxy->class_code !=PCI_CLASS_STORAGE_OTHER ) proxy->class_code =PCI_CLASS_STORAGE_SCSI ; - -virtio_blk_init_pci_with_class (pci_dev, proxy->class_code); -} - -static void virtio_blk_init_pci_0_10 (PCIDevice *pci_dev) -{ -virtio_blk_init_pci_with_class (pci_dev,PCI_CLASS_STORAGE_OTHER ); -} - -static void virtio_console_init_pci_with_class (PCIDevice *pci_dev, -uint16_t class_code) -{ -VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev); -VirtIODevice *vdev; - vdev =virtio_console_init (&pci_dev->qdev); + vdev =virtio_blk_init (&pci_dev->qdev);virtio_init_pci (proxy, vdev,PCI_VENDOR_ID_REDHAT_QUMRANET , -PCI_DEVICE_ID_VIRTIO_CONSOLE , - class_code,0x00 ); +PCI_DEVICE_ID_VIRTIO_BLOCK , + proxy->class_code,0x00 ); }static void virtio_console_init_pci (PCIDevice *pci_dev) {VirtIOPCIProxy *proxy =DO_UPCAST (VirtIOPCIProxy, pci_dev, pci_dev); - +VirtIODevice *vdev; +if (proxy->class_code !=PCI_CLASS_COMMUNICATION_OTHER && proxy->class_code !=PCI_CLASS_DISPLAY_OTHER &&/* qemu 0.10 */ proxy->class_code !=PCI_CLASS_OTHERS )/* qemu-kvm */ proxy->class_code =PCI_CLASS_COMMUNICATION_OTHER ; -virtio_console_init_pci_with_class (pci_dev, proxy->class_code); -} - -static void virtio_console_init_pci_0_10 (PCIDevice *pci_dev) -{ -virtio_console_init_pci_with_class (pci_dev,PCI_CLASS_DISPLAY_OTHER ); + vdev =virtio_console_init (&pci_dev->qdev); +virtio_init_pci (proxy, vdev, +PCI_VENDOR_ID_REDHAT_QUMRANET , +PCI_DEVICE_ID_VIRTIO_CONSOLE , + proxy->class_code,0x00 ); }static void virtio_net_init_pci (PCIDevice *pci_dev)
@@ -561,15 +535,6 @@ static PCIDeviceInfo virtio_info[] = { .qdev.size = sizeof(VirtIOPCIProxy), .init = virtio_balloon_init_pci, },{ -/* For compatibility with 0.10 */ - .qdev.name = "virtio-blk-pci-0-10", - .qdev.size = sizeof(VirtIOPCIProxy), - .init = virtio_blk_init_pci_0_10, - },{ - .qdev.name = "virtio-console-pci-0-10", - .qdev.size = sizeof(VirtIOPCIProxy), - .init = virtio_console_init_pci_0_10, - },{/* end of list */ } };
Signature · 1 line
1.6.2.5
PATCH 3/4 Add machine type aliases
In reply to Mark McLoughlinAdd an 'alias' field to QEMUMachine and display it in the output of 'qemu -M ?' with an '(aliased to foo)' suffix.
Aliases can change targets in newer versions of qemu, so management tools may choose canonicalize machine types to ensure that if a user chooses an alias, that the actual machine type used will remain compatible in future.
This is intended to mimic a symlink to a machine description file.
--- hw/boards.h | 1 + vl.c | 5 +++++ 2 files changed, 6 insertions(+), 0 deletions(-)
hw/boards.h +1 -0
@@ -14,6 +14,7 @@ typedef void QEMUMachineInitFunc(ram_addr_t ram_size, typedef struct QEMUMachine { const char *name; + const char *alias; const char *desc; QEMUMachineInitFunc *init; int use_scsi;
vl.c +5 -0
@@ -3357,6 +3357,8 @@ static QEMUMachine *find_machine(const char *name)for (m = first_machine; m !=NULL ; m = m->next) {if (!strcmp (m->name, name))return m; +if (m->alias && !strcmp (m->alias, name)) +return m; }return NULL ; }
@@ -4993,6 +4995,9 @@ int main(int argc, char **argv, char **envp)QEMUMachine *m;printf ("Supported machines are:\n" );for (m = first_machine; m !=NULL ; m = m->next) { +if (m->alias) +printf ("%-10s %s (alias of %s)\n" , + m->alias, m->desc, m->name);printf ("%-10s %s%s\n" , m->name, m->desc, m->is_default ?" (default)" :"" );
Signature · 1 line
1.6.2.5
PATCH 4/4 Add a pc-0.11 machine type and make the pc type an alias
In reply to Mark McLoughlinThe pc-0.11 type allows users of qemu-0.11 to use a machine type which they know will remain compatible when the upgrade to qemu-0.12.
Management tools may choose to canonicalize the 'pc' machine type to 'pc-0.11' so that if the 'pc' alias changes target in future versions of qemu, the machine type used will remain compatible.
--- hw/pc.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
hw/pc.c +2 -1
@@ -1477,7 +1477,8 @@ void cmos_set_s3_resume(void) }static QEMUMachine pc_machine = { - .name ="pc" , + .name ="pc-0.11" , + .alias ="pc" , .desc ="Standard PC" , .init = pc_init_pci, .max_cpus =255 ,
Signature · 1 line
1.6.2.5
Re: [Qemu-devel] [PATCH 3/3 v2] Add a pc-0-10 machine type for compatibility with 0.10.x
In reply to Anthony LiguoriQuoted 1 line · Anthony Liguori
Linear versioning doesn't work because there are too many forks of QEMU (each distro release that includes backported features is a fork).
So long as distro backports are non-default it should work out. If we can set things up so a backport naturally winds up non-default, maybe we can restore some sanity.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: [Qemu-devel] [PATCH 2/3] Change default PCI class of virtio-console to PCI_CLASS_SERIAL_OTHER
In reply to Mark McLoughlinQuoted 5 lines · Mark McLoughlin
hw/pci_ids.h +0
-0
hw/pci_ids.h line 43
Quoted 9 lines
hw/pci_ids.h +3
-0@@ -35,6 +35,9 @@#define PCI_CLASS_BRIDGE_PCI 0x0604#define PCI_CLASS_BRIDGE_OTHER 0x0680 +#define PCI_CLASS_SERIAL_OTHER 0x0780 + +#define PCI_CLASS_PROCESSOR_CO 0x0b40#define PCI_CLASS_COMMUNICATION_OTHER 0x0780#define PCI_CLASS_PROCESSOR_CO 0x0b40
Those defines already exist; they're also seen in the hunk:PCI_CLASS_COMMUNICATION_OTHER and the other with the same name.
Amit
Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 6 lines · Avi Kivity
Quoted 5 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Quoted 8 lines
Quoted 4 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Correct.
Quoted 13 lines
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addrwas never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
Quoted 3 lines
If all devices (including vga, ide) are set up with
pci_addr, then this is unneeded. You do need to export available slot numbers from qemu.
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
[*] There's an exception or two for oddball targets.
Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 6 lines · Avi Kivity
Quoted 5 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Quoted 8 lines
Quoted 4 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Correct.
Quoted 13 lines
Quoted 3 lines
However, the first problem is that it isn't a solution to the guest ABI problem more generally.
pci_addrwas never meant to bring world peace, just stable PCI addresses. The other issues should be addressed separately.Quoted 5 lines
And the second problem is that for e.g. libvirt to use it, it would have to be possible to query qemu for what PCI slots were assigned to the devices - libvirt would need to be able to parse 'info pci' and match the devices listed with the devices specified on the command line.
Quoted 3 lines
If all devices (including vga, ide) are set up with
pci_addr, then this is unneeded. You do need to export available slot numbers from qemu.
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
[*] There's an exception or two for oddball targets.
Re: Configuration vs. compat hints
(adding cc)
Quoted 3 lines · Markus Armbruster
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
qemu needs to export these two bits of information: the first free slot and the number of slots.
More generally, which slots are open. We can assume 1:31, but that's unlovely.
Quoted 5 lines
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints
In reply to Markus Armbruster(adding cc)
Quoted 3 lines · Markus Armbruster
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
qemu needs to export these two bits of information: the first free slot and the number of slots.
More generally, which slots are open. We can assume 1:31, but that's unlovely.
Quoted 5 lines
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Re: Configuration vs. compat hints
Quoted 3 lines · Avi Kivity
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
It is not just you.
Re: [Qemu-devel] Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 3 lines · Avi Kivity
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
It is not just you.
Re: [Qemu-devel] Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 7 lines · Avi Kivity
(adding cc)
Quoted 3 lines · Markus Armbruster
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
Quoted 5 lines
qemu needs to export these two bits of information: the first free slot and the number of slots.
More generally, which slots are open. We can assume 1:31, but that's unlovely.
Point.
Quoted 10 lines
Quoted 5 lines
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
Yup.
I got bit-rotten patches for pci_addr=, and I can unrot them if they're wanted.
Quoted 2 lines
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
Ha, .bash_history as config file...
Re: [Qemu-devel] Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 7 lines · Avi Kivity
(adding cc)
Quoted 3 lines · Markus Armbruster
Not really. QEMU gives just the host bridge a fixed slot[*]. All the other slots are available.
Quoted 5 lines
qemu needs to export these two bits of information: the first free slot and the number of slots.
More generally, which slots are open. We can assume 1:31, but that's unlovely.
Point.
Quoted 10 lines
Quoted 5 lines
The real problem is devices that get implicitly added, like the SCSI controller. Those devices get their slots auto-assigned, which can interfere with slot numbers chosen by the user. We need a way to avoid that, as you suggested elsewhere in this thread.
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
Yup.
I got bit-rotten patches for pci_addr=, and I can unrot them if they're wanted.
Quoted 2 lines
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
Ha, .bash_history as config file...
Re: [Qemu-devel] Re: Configuration vs. compat hints
Quoted 9 lines · Markus Armbruster
Quoted 5 lines · Avi Kivity
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
Quoted 5 lines
Yup.
I got bit-rotten patches for pci_addr=, and I can unrot them if they're wanted.
Yes, would be good to have patches on the list to discuss. In principle, I have no objection to this.
Regards,
Anthony Liguori
Re: [Qemu-devel] Re: Configuration vs. compat hints
In reply to Markus ArmbrusterQuoted 9 lines · Markus Armbruster
Quoted 5 lines · Avi Kivity
Paul/Anthony, can we have -vga pci_addr=, -usb-controller pci_addr=, and -drive pci_addr= (and later, -disk-controller)? Stalling while waiting for the ultimate config file is only generating pain and out-of-tree patches.
Quoted 5 lines
Yup.
I got bit-rotten patches for pci_addr=, and I can unrot them if they're wanted.
Yes, would be good to have patches on the list to discuss. In principle, I have no objection to this.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 2 lines · Avi Kivity
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
as a user-only (well, i'm a developer, but don't meddle in kernel affairs since 0.99pl9); I also like that kvm is totally CLI-managed.
but migration-wise, i think it could be nicer if the 'origin' process could send the config to the 'target' one. IOW: the -incoming flag shouldn't need any other parameter, and the 'migrate' command should send the whole hardware description before the CPU state, and fail with a 'can't comply' message if the target complains.
of course, that's a simplification. for example, the 'target' process should be able to respect some parameters, mostly the 'external' descriptions, like storage pathnames, or '-net tap' ones.
Signature · 1 line
Javier
Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 2 lines · Avi Kivity
(I'd be quite happy constructing the entire machine config on the command line, but I realize it's just me)
as a user-only (well, i'm a developer, but don't meddle in kernel affairs since 0.99pl9); I also like that kvm is totally CLI-managed.
but migration-wise, i think it could be nicer if the 'origin' process could send the config to the 'target' one. IOW: the -incoming flag shouldn't need any other parameter, and the 'migrate' command should send the whole hardware description before the CPU state, and fail with a 'can't comply' message if the target complains.
of course, that's a simplification. for example, the 'target' process should be able to respect some parameters, mostly the 'external' descriptions, like storage pathnames, or '-net tap' ones.
Signature · 1 line
Javier
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 6 lines · Avi Kivity
Quoted 5 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Quoted 8 lines
Quoted 4 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
I think it's a perfectly fine idea.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 6 lines · Avi Kivity
Quoted 5 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Quoted 6 lines
Quoted 4 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
I think it's a perfectly fine idea.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Anthony Liguori
Quoted 7 lines
Quoted 3 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
Izik Eidus posted a patch (using a different syntax) in November 2007.
Quoted 2 lines
I think it's a perfectly fine idea.
Good.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 8 lines · Anthony Liguori
Quoted 5 lines
Quoted 3 lines
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
Izik Eidus posted a patch (using a different syntax) in November 2007.
Quoted 2 lines
I think it's a perfectly fine idea.
Good.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints
In reply to Anthony LiguoriQuoted 12 lines · Anthony Liguori
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
Quoted 5 lines
Quoted 3 lines
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
http://www.archivum.info/[email protected]/2009-01/msg01458.html
Quoted 1 line
I think it's a perfectly fine idea.
Off to dust off my patch series.
Re: Configuration vs. compat hints
In reply to Anthony LiguoriQuoted 12 lines · Anthony Liguori
Quoted 11 lines · Avi Kivity
Quoted 9 lines · Mark McLoughlin
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yep, most people seem to agree that it makes sense to allow this, but some believe it should only be via a machine description file, not the command line.
Quoted 5 lines
Quoted 3 lines
I don't understand this opposition. It's clear a machine config file is a long way in our future. It's also clear lack of stable PCI addresses hurts us now.
Is there opposition? I don't ever recall seeing a patch...
http://www.archivum.info/[email protected]/2009-01/msg01458.html
Quoted 1 line
I think it's a perfectly fine idea.
Off to dust off my patch series.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 12 lines · Michael S. Tsirkin
Quoted 9 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file), then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Michael S. TsirkinQuoted 12 lines · Michael S. Tsirkin
Quoted 9 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file), then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Signature · 1 line
error compiling committee.c: too many arguments to function
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 22 lines · Avi Kivity
Quoted 12 lines · Michael S. Tsirkin
Quoted 9 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file), then turns on the power. Command line options are the parts lying around when we start.
Quoted 7 lines
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Maybe we need a generic 'bus options' flag.
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 22 lines · Avi Kivity
Quoted 12 lines · Michael S. Tsirkin
Quoted 9 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to figure out what address to use, libvirt would need to query qemu for what address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file), then turns on the power. Command line options are the parts lying around when we start.
Quoted 7 lines
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Maybe we need a generic 'bus options' flag.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 15 lines · Avi Kivity
Quoted 14 lines · Michael S. Tsirkin
Quoted 11 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to
figure
out what address to use, libvirt would need to query qemu for
what
address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 7 lines
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
Quoted 10 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line. -drive is convenient syntax. It stops being convenient when you force it to be two options.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 15 lines · Avi Kivity
Quoted 14 lines · Michael S. Tsirkin
Quoted 11 lines · Mark McLoughlin
However, in order to retain compat for that SCSI device (e.g. ensuring the PCI address doesn't change as other devices are added an removed), we're back to the same problem ... either:
1) Use '-drive file=foo.img,if=scsi,pci_addr=foo'; in order to
figure
out what address to use, libvirt would need to query qemu for
what
address was originally allocated to device or it would do all the PCI address allocation itself ...
Quoted 6 lines
Quoted 4 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
Quoted 9 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line. -drive is convenient syntax. It stops being convenient when you force it to be two options.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Anthony Liguori
Quoted 6 lines
Quoted 3 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
I'd be sad too, but not surprised.
Quoted 5 lines
Quoted 5 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
Quoted 8 lines
Quoted 5 lines
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
Quoted 2 lines
-drive is convenient syntax. It stops being convenient when you force it to be two options.
controller= defaults to some builtin thing which autoinstantiates when necessary, so the old -drive syntax works.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 8 lines · Anthony Liguori
Quoted 5 lines
Quoted 3 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
I'd be sad too, but not surprised.
Quoted 11 lines
Quoted 9 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
Quoted 2 lines
-drive is convenient syntax. It stops being convenient when you force it to be two options.
controller= defaults to some builtin thing which autoinstantiates when necessary, so the old -drive syntax works.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 25 lines · Avi Kivity
Quoted 10 lines · Anthony Liguori
Quoted 6 lines
Quoted 3 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
I'd be sad too, but not surprised.
Quoted 11 lines
Quoted 10 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Quoted 8 lines
Quoted 2 lines
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
It's not at all that simple. SCSI has a hierarchical address mechanism
with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
For IDE, it's a combination of bus, slot, and master/slave. For virtio, it's just a PCI address. What we really need is something that is more opaque and controller specific. For instance, if we were going to do controllers...
-controller type=lsi1234,pci_addr=foobar,name=blah -controller-disk controller=blah,target=0,lun=1,name=sda
-controller type=ide,pci_addr=barfoo,name=ide -controller-disk controller=ide,slot=secondary,cable=slave,name=hdd
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
And having "-hdd file=foo.img" be short-hand for "-drive file=%s,controller-disk=%s".
Quoted 5 lines
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects bus_id though so in practice, I assume it's almost universally broken.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 20 lines · Avi Kivity
Quoted 8 lines · Anthony Liguori
Quoted 5 lines
Quoted 3 lines
This last option makes sense to me: in a real world the user has control over where he places the device on the bus, so why not with qemu?
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
I'd be sad too, but not surprised.
Quoted 8 lines
Quoted 8 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
It's not at all that simple. SCSI has a hierarchical address mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
For IDE, it's a combination of bus, slot, and master/slave. For virtio, it's just a PCI address. What we really need is something that is more opaque and controller specific. For instance, if we were going to do controllers...
-controller type=lsi1234,pci_addr=foobar,name=blah -controller-disk controller=blah,target=0,lun=1,name=sda
-controller type=ide,pci_addr=barfoo,name=ide -controller-disk controller=ide,slot=secondary,cable=slave,name=hdd
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
And having "-hdd file=foo.img" be short-hand for "-drive file=%s,controller-disk=%s".
Quoted 3 lines
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects bus_id though so in practice, I assume it's almost universally broken.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 22 lines · Anthony Liguori
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Drives to not have pci addresses.
Quoted 8 lines
Quoted 2 lines
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
Quoted 6 lines
It's not at all that simple. SCSI has a hierarchical address
mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
Well, another level in the hierarchy, but I don't think it materially changes things.
Quoted 4 lines
For IDE, it's a combination of bus, slot, and master/slave. For virtio, it's just a PCI address. What we really need is something that is more opaque and controller specific.
virtio also has a bus (did you mean the pci bus for IDE?), master/slave is the index. virtio doesn't have index, but IMO that was a mistake and we should have designed it as a disk controller in the first place.
Quoted 11 lines
For instance, if we were going to do controllers...
(quoted diff) +0
-6-controller type=lsi1234,pci_addr=foobar,name=blah -controller-disk controller=blah,target=0,lun=1,name=sda -controller type=ide,pci_addr=barfoo,name=ide -controller-disk controller=ide,slot=secondary,cable=slave,name=hdd -drive file=foo.img,controller-disk=sda -drive file=bar.img,controller-disk=hdd
Quoted 2 lines
And having "-hdd file=foo.img" be short-hand for "-drive file=%s,controller-disk=%s".
Yeah.
Quoted 6 lines
Quoted 5 lines
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
Quoted 7 lines
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.
Isn't the drive table something totally internal? And how does bus= relate to it?
Confused.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 9 lines · Anthony Liguori
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
then turns on the power. Command line options are the parts lying around when we start.
btw, -drive needs to be separated:
-controller type=lsi1234,pci_addr=foobar,name=blah -drive file=foo.img,controller=blah,index=0 -drive file=bar.img,controller=blah,index=1
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Drives to not have pci addresses.
Drivers don't have indexes and buses but we specify it on the -drive line.
Drives do have indexes. On old parallel scsi drives you set the index by clicking a button on the back of the drive to cycle through scsi addresses 0-7. An IDE drive's index is determined by the cable (master/slave). A SATA drive's index is determined by which header on the motherboard the drive connects to.
It's not at all that simple. SCSI has a hierarchical address mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
Well, another level in the hierarchy, but I don't think it materially changes things.
Quoted 2 lines
For IDE, it's a combination of bus, slot, and master/slave. For virtio, it's just a PCI address. What we really need is something that is more opaque and controller specific.
virtio also has a bus (did you mean the pci bus for IDE?), master/slave is the index. virtio doesn't have index, but IMO that was a mistake and we should have designed it as a disk controller in the first place.
Quoted 11 lines
For instance, if we were going to do controllers...
(quoted diff) +0
-6-controller type=lsi1234,pci_addr=foobar,name=blah -controller-disk controller=blah,target=0,lun=1,name=sda -controller type=ide,pci_addr=barfoo,name=ide -controller-disk controller=ide,slot=secondary,cable=slave,name=hdd -drive file=foo.img,controller-disk=sda -drive file=bar.img,controller-disk=hdd
Quoted 1 line
And having "-hdd file=foo.img" be short-hand for "-drive file=%s,controller-disk=%s".
Yeah.
Quoted 5 lines
Quoted 3 lines
If by bus you mean the if= parameter, then drives certainly do have buses. Just try connecting the scsi drive from the previous paragraph to a USB port.
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.
Isn't the drive table something totally internal? And how does bus= relate to it?
Confused.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori
It's not at all that simple. SCSI has a hierarchical address
mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.Well, another level in the hierarchy, but I don't think it materially changes things.
Depends on whether you expect to say index=0,lun=3 or index=3. If you mean the later, then it's quite conceivable that each target supports less than the maximum number of LUNs. This makes things pretty confusing to the user because they have to know that in the current implementation, index=0 is valid, index=1 isn't, but index=8 is.
Quoted 10 lines
Quoted 7 lines
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.Isn't the drive table something totally internal? And how does bus= relate to it?
The reality of unit=X,bus=Y,if=Z is that they expand to:
drive_table_index=Y*max_devs[Z] + X
Whereas max_devs = {"ide":4, "scsi": 7, *:0}
How drive_table_index is interpreted is "if" specific. For if=scsi, each lsi device gets a base drive table index that starts at bus_index *
7. For virtio, the first empty spot in drive_table results in no more drives being created.
It's broken by design.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 4 lines · Avi Kivity
Quoted 1 line · Anthony Liguori
It's not at all that simple. SCSI has a hierarchical address mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
Well, another level in the hierarchy, but I don't think it materially changes things.
Depends on whether you expect to say index=0,lun=3 or index=3. If you mean the later, then it's quite conceivable that each target supports less than the maximum number of LUNs. This makes things pretty confusing to the user because they have to know that in the current implementation, index=0 is valid, index=1 isn't, but index=8 is.
Quoted 3 lines
Quoted 1 line
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.Isn't the drive table something totally internal? And how does bus= relate to it?
The reality of unit=X,bus=Y,if=Z is that they expand to:
drive_table_index=Y*max_devs[Z] + X
Whereas max_devs = {"ide":4, "scsi": 7, *:0}
How drive_table_index is interpreted is "if" specific. For if=scsi, each lsi device gets a base drive table index that starts at bus_index * 7. For virtio, the first empty spot in drive_table results in no more drives being created.
It's broken by design.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Anthony Liguori
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Anthony Liguori
It's not at all that simple. SCSI has a hierarchical address
mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
Quoted 8 lines
Quoted 2 lines
Well, another level in the hierarchy, but I don't think it materially changes things.
Depends on whether you expect to say index=0,lun=3 or index=3. If you mean the later, then it's quite conceivable that each target supports less than the maximum number of LUNs. This makes things pretty confusing to the user because they have to know that in the current implementation, index=0 is valid, index=1 isn't, but index=8 is.
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
Quoted 15 lines
Quoted 10 lines
Quoted 7 lines
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.Isn't the drive table something totally internal? And how does bus= relate to it?
The reality of unit=X,bus=Y,if=Z is that they expand to:
drive_table_index=Y*max_devs[Z] + X
Quoted 8 lines
Whereas
max_devs= {"ide":4, "scsi": 7, *:0}How
drive_table_indexis interpreted is "if" specific. For if=scsi, each lsi device gets a base drive table index that starts atbus_index
* 7. For virtio, the first empty spot indrive_tableresults in no more drives being created.It's broken by design.
Agreed. Pity that it's exposed to the poor users.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity
Quoted 1 line · Anthony Liguori
It's not at all that simple. SCSI has a hierarchical address mechanism with 0-7 targets but then potentially multiple LUNs per target. Today, we always emulate a single LUN per target but if we ever wanted to support more than 7 disks on a SCSI controller, we would have to add multiple LUN support too. So the current linear unit= parameter is actually pretty broken for SCSI.
Well, another level in the hierarchy, but I don't think it materially changes things.
Depends on whether you expect to say index=0,lun=3 or index=3. If you mean the later, then it's quite conceivable that each target supports less than the maximum number of LUNs. This makes things pretty confusing to the user because they have to know that in the current implementation, index=0 is valid, index=1 isn't, but index=8 is.
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
Quoted 6 lines
Quoted 3 lines
Quoted 1 line
No, I meant drive file=foo.img,bus=3. If that doesn't seem obvious what it should do to you that's because it isn't at all obvious :-) It ends up skipping a predefined number of locations in the drive table. This is pretty broken fundamentally because it assumes controllers always support a fixed number of devices. Nothing really respects
bus_idthough so in practice, I assume it's almost universally broken.Isn't the drive table something totally internal? And how does bus= relate to it?
The reality of unit=X,bus=Y,if=Z is that they expand to:
Quoted 7 lines
drive_table_index=Y*max_devs[Z] + X
Whereas
max_devs= {"ide":4, "scsi": 7, *:0}How
drive_table_indexis interpreted is "if" specific. For if=scsi, each lsi device gets a base drive table index that starts atbus_index* 7. For virtio, the first empty spot indrive_tableresults in no more drives being created.It's broken by design.
Agreed. Pity that it's exposed to the poor users.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 4 lines · Avi Kivity
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).
An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:
-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda
-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 2 lines · Avi Kivity
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).
An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:
-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda
-controller type=ide,addr=00.02,name=ide
-controller-disk controller=ide,addr=3,name=hdd
-drive file=foo.img,controller-disk=sda
-drive file=bar.img,controller-disk=hdd
This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 21 lines · Anthony Liguori
Quoted 4 lines · Avi Kivity
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).
An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:
(quoted diff) +0
-6-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda -controller type=ide,addr=00.02,name=ide -controller-disk controller=ide,addr=3,name=hdd -drive file=foo.img,controller-disk=sda -drive file=bar.img,controller-disk=hdd
Quoted 5 lines
This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.
I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.
There's value in sticking to well-understood names and address formats.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 17 lines · Anthony Liguori
Quoted 2 lines · Avi Kivity
I'd object to any implicit addressing rules. If we have to say target=2,lun=7,street=8,city=9,state=99,zip=12345 instead of index=8345345235 so be it.
The next observation is that while we expand the SCSI addressing, the current propose flattens the PCI hierarchy (i.e. pci_addr=00:01.0).
An alternative would be to either always expand or always flatten addressing. I think the later has a lot of merit. Consider:
(quoted diff) +0
-6-controller type=lsi1234,addr=00:01,name=blah -controller-disk controller=blah,addr=00:01,name=sda -controller type=ide,addr=00.02,name=ide -controller-disk controller=ide,addr=3,name=hdd -drive file=foo.img,controller-disk=sda -drive file=bar.img,controller-disk=hdd
Quoted 1 line
This means that addr's format depends on the parent device node which is a bit less explicit than the previous example. However, it is much more consistent and easier to implement. Basically, when adding a device to it's parent, you hand the parent the "addr" field and that lets you say where you want to sit on the bus.
I would prefer explicit names (pci_addr, lun, etc.) but would be okay with generic names too.
There's value in sticking to well-understood names and address formats.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 2 lines · Avi Kivity
I would prefer explicit names (
pci_addr, lun, etc.) but would be okay with generic names too.
I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 1 line · Avi Kivity
I would prefer explicit names (
pci_addr, lun, etc.) but would be okay with generic names too.
I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Anthony Liguori
Quoted 2 lines · Avi Kivity
I would prefer explicit names (
pci_addr, lun, etc.) but would be okay with generic names too.I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.
The code problems are easily solved by adding another level of indirection. User confusion problems are only aggravated by additional abstraction, though ("what do I put in addr=, here?").
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 4 lines · Anthony Liguori
Quoted 1 line · Avi Kivity
I would prefer explicit names (
pci_addr, lun, etc.) but would be okay with generic names too.I think having a generic address has a lot of value in terms of code implementation. Otherwise, the valid options for -drive become context-sensitive which is going to be annoying and error-prone. Some sanity could be added by using addressing prefixes like addr=pci:00:01.0 or addr=scsi:0.3 but I'll leave that up to whoever takes this on.
The code problems are easily solved by adding another level of indirection. User confusion problems are only aggravated by additional abstraction, though ("what do I put in addr=, here?").
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriHi,
Quoted 5 lines
Quoted 2 lines
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
It shouldn't last until 2017, but the process isn't that trivial. Some qemu code / control flow needs serious restruction until it is in a state that creating the devices from a fdt can actually work.
Quoted 3 lines
Drivers don't have indexes and buses but we specify it on the -drive line. -drive is convenient syntax. It stops being convenient when you force it to be two options.
One more issue: -drive also mixes host and guest configuration. These must be separated too.
cheers,
Gerd
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriHi,
Quoted 5 lines
Quoted 2 lines
Yes, the user build the machine using the command line and monitor (or, in 2017, the machine configuration file),
Considering pbrook just posted a machine config for arm, I think it would be rather sad if pc wasn't converted to it by 2017...
It shouldn't last until 2017, but the process isn't that trivial. Some qemu code / control flow needs serious restruction until it is in a state that creating the devices from a fdt can actually work.
Quoted 3 lines
Drivers don't have indexes and buses but we specify it on the -drive line. -drive is convenient syntax. It stops being convenient when you force it to be two options.
One more issue: -drive also mixes host and guest configuration. These must be separated too.
cheers,
Gerd
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 3 lines · Anthony Liguori
What's the problem with parsing the device config and modifying it? Is it just complexity?
Two-way modification. Management wants to store the configuration in their database and tell the hypervisor what the machine looks like. If qemu also tells management what the machine looks like, we can easily get conflicts.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 2 lines · Anthony Liguori
What's the problem with parsing the device config and modifying it? Is it just complexity?
Two-way modification. Management wants to store the configuration in their database and tell the hypervisor what the machine looks like. If qemu also tells management what the machine looks like, we can easily get conflicts.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 9 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
In my mind, that's what compat hints is. I don't see another sane way to implement it.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
Quoted 8 lines
Quoted 3 lines
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
In my mind, that's what compat hints is. I don't see another sane way to implement it.
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
The other obvious piece to add to it would be PCI addresses, so that even if you remove a device, the addresses assigned to existing devices don't change.
Cheers,
Mark.
[1] - Adding such a per-device version number to the config file would solve problem (2)
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 7 lines · Anthony Liguori
Quoted 6 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
Quoted 8 lines
Quoted 3 lines
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
In my mind, that's what compat hints is. I don't see another sane way to implement it.
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
The other obvious piece to add to it would be PCI addresses, so that even if you remove a device, the addresses assigned to existing devices don't change.
Cheers,
Mark.
[1] - Adding such a per-device version number to the config file would solve problem (2)
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 16 lines · Mark McLoughlin
Quoted 14 lines · Anthony Liguori
Quoted 10 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
Quoted 9 lines
Quoted 3 lines
In my mind, that's what compat hints is. I don't see another sane way to implement it.
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
I think the point is that you don't need version numbers if you have a proper device tree. NB the device tree contains no host configuration information.
Regards,
Anthony Liguori
Quoted 11 lines
The other obvious piece to add to it would be PCI addresses, so that even if you remove a device, the addresses assigned to existing devices don't change.
Cheers,
Mark.[1] - Adding such a per-device version number to the config file would solve problem (2)
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 16 lines · Mark McLoughlin
Quoted 14 lines · Anthony Liguori
Quoted 10 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
Quoted 8 lines
Quoted 2 lines
In my mind, that's what compat hints is. I don't see another sane way to implement it.
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
I think the point is that you don't need version numbers if you have a proper device tree. NB the device tree contains no host configuration information.
Regards,
Anthony Liguori
Quoted 11 lines
The other obvious piece to add to it would be PCI addresses, so that even if you remove a device, the addresses assigned to existing devices don't change.
Cheers,
Mark.[1] - Adding such a per-device version number to the config file would solve problem (2)
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 21 lines · Anthony Liguori
Quoted 20 lines · Mark McLoughlin
Quoted 17 lines · Anthony Liguori
Quoted 10 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
In my mind, that's what compat hints is. I don't see another sane way to implement it.
Quoted 8 lines
Quoted 5 lines
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Quoted 1 line
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 21 lines · Anthony Liguori
Quoted 20 lines · Mark McLoughlin
Quoted 17 lines · Anthony Liguori
Quoted 10 lines · Mark McLoughlin
On Wed, 2009-06-10 at 20:27 +0100, Jamie Lokier wrote:
= Solution - Separate configuration from compat hints =
As I suggested before:
- Allow the VM manager to dump compat hints; this would be an opaque file format, more like the savevm format than a config file
How is compat hints different from a device tree?
In my mind, that's what compat hints is. I don't see another sane way to implement it.
Quoted 8 lines
Quoted 5 lines
A device tree with a different purpose than a config file.
In its simplest form it could be a device tree with a version number for each device[1].
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Quoted 1 line
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 9 lines · Mark McLoughlin
Quoted 3 lines
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
Quoted 7 lines
Quoted 3 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Or in a different file. I agree splitting host and guest configuration is a must-have, this ensures portability of virtual machines across hosts and time.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 8 lines · Mark McLoughlin
Quoted 2 lines
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
Quoted 7 lines
Quoted 3 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Or in a different file. I agree splitting host and guest configuration is a must-have, this ensures portability of virtual machines across hosts and time.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints
Quoted 1 line · Avi Kivity
Mark McLoughlin wrote:
[...]
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Or in a different file. I agree splitting host and guest configuration is a must-have, this ensures portability of virtual machines across hosts and time.
Splitting into two separate sections should suffice, they could live in the same file for convenience.
Re: Configuration vs. compat hints
In reply to Avi KivityQuoted 1 line · Avi Kivity
Mark McLoughlin wrote:
[...]
Quoted 10 lines
Quoted 6 lines
Quoted 2 lines
NB the device tree contains no host configuration information.
So, it wouldn't e.g. include the path to the image file for a block device? That would always be specified on the command line?
Or in a different file. I agree splitting host and guest configuration is a must-have, this ensures portability of virtual machines across hosts and time.
Splitting into two separate sections should suffice, they could live in the same file for convenience.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 8 lines · Avi Kivity
Quoted 4 lines · Mark McLoughlin
Quoted 3 lines
I think the point is that you don't need version numbers if you have a proper device tree.
Quoted 7 lines
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 8 lines · Avi Kivity
Quoted 4 lines · Mark McLoughlin
Quoted 3 lines
I think the point is that you don't need version numbers if you have a proper device tree.
Quoted 7 lines
Quoted 5 lines
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 10 lines · Mark McLoughlin
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Quoted 7 lines
Quoted 2 lines
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Mark McLoughlinQuoted 10 lines · Mark McLoughlin
Quoted 10 lines
Quoted 10 lines
Quoted 4 lines
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Quoted 7 lines
Quoted 2 lines
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 20 lines · Avi Kivity
Quoted 11 lines · Mark McLoughlin
Quoted 11 lines
Quoted 11 lines
Quoted 5 lines
I think the point is that you don't need version numbers if you have a
proper device tree.How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
Quoted 7 lines
Quoted 2 lines
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
Quoted 6 lines
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
-M pc1
-M pc2
etc.
This is pretty easy to maintain with config files.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 14 lines · Avi Kivity
Quoted 13 lines · Mark McLoughlin
Quoted 12 lines
Quoted 10 lines
Quoted 4 lines
I think the point is that you don't need version numbers if you have a proper device tree.
How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
Quoted 6 lines
Quoted 4 lines
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
-M pc1
-M pc2
etc.
This is pretty easy to maintain with config files.
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 18 lines · Anthony Liguori
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
Quoted 4 lines
device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
That's a version number :-)
Quoted 8 lines
Quoted 1 line
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
How do you add a new attribute to the device tree and, when a supplied
Review
Quoted 2 lines
(quoted diff) +0
-2-M pc1 -M pc2
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 13 lines · Anthony Liguori
Quoted 11 lines
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default. Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
How do you add a new attribute to the device tree and, when a supplied
Review
Quoted 2 lines
(quoted diff) +0
-2-M pc1 -M pc2
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 6 lines · Avi Kivity
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
I mentioned it because it suggests a good transition. We at least have to think through how things map to the post-config file world regardless of whether that's a few months from now or a decade :-)
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Avi KivityQuoted 6 lines · Avi Kivity
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
I mentioned it because it suggests a good transition. We at least have to think through how things map to the post-config file world regardless of whether that's a few months from now or a decade :-)
Regards,
Anthony Liguori
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 11 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
I mentioned it because it suggests a good transition. We at least have to think through how things map to the post-config file world regardless of whether that's a few months from now or a decade :-)
Sure, it's good both from the transitional point of view and in its own right.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 9 lines · Anthony Liguori
Quoted 6 lines · Avi Kivity
Certainly preferable to -baseline.
Quoted 1 line
This is pretty easy to maintain with config files.
Let's not tie the two together.
I mentioned it because it suggests a good transition. We at least have to think through how things map to the post-config file world regardless of whether that's a few months from now or a decade :-)
Sure, it's good both from the transitional point of view and in its own right.
Signature · 1 line
error compiling committee.c: too many arguments to function
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 16 lines · Anthony Liguori
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Mark McLoughlin
Quoted 13 lines
Quoted 11 lines
Quoted 5 lines
I think the point is that you don't need version numbers if you have a
proper device tree.How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default.
No need to punish new guests in order to maintain compatibility for old guests.
Quoted 9 lines
Quoted 5 lines
Eventually the
default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.(quoted diff) +0
-2-M pc1 -M pc2
Quoted 3 lines
etc.
This is pretty easy to maintain with config files.
I think this would be reasonable, but it is essentially just a version number which you objected to on the basis that it would make cherry-picking harder for distros.
One thing that would be nice with this '-M pc1' thing would be to retain '-M pc' as a symlink to the latest version. We'd also need a way to read the symlink too, so that you can query what the current latest version is and use that in future.
How would this machine type version relate to e.g. changing the default PCI class of virtio-blk? Would we bump the version number of all machine types can use virtio-blk?
A per-device version number is workable alternative, but only with a saveabi type file IMHO.
I've tried to summarise the options here:
https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
In reply to Anthony LiguoriQuoted 16 lines · Anthony Liguori
Quoted 15 lines · Avi Kivity
Quoted 14 lines · Mark McLoughlin
Quoted 13 lines
Quoted 11 lines
Quoted 5 lines
I think the point is that you don't need version numbers if you have a
proper device tree.How do you add a new attribute to the device tree and, when a supplied device tree lacking said attribute, distinguish between a device tree from an old version of qemu (i.e. use the old default) and a partial device tree from the VM manager (i.e. use the new default) ?
-baseline 0.10
Quoted 7 lines
Quoted 7 lines
Quoted 4 lines
That's a version number :-)
(I was responding to Anthony's "you don't need a version number")
If you want to prevent incompatibilities, you need to make everything new (potentially including bugfixes) non-default.
No need to punish new guests in order to maintain compatibility for old guests.
Quoted 9 lines
Quoted 5 lines
Eventually the
default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.(quoted diff) +0
-2-M pc1 -M pc2
Quoted 3 lines
etc.
This is pretty easy to maintain with config files.
I think this would be reasonable, but it is essentially just a version number which you objected to on the basis that it would make cherry-picking harder for distros.
One thing that would be nice with this '-M pc1' thing would be to retain '-M pc' as a symlink to the latest version. We'd also need a way to read the symlink too, so that you can query what the current latest version is and use that in future.
How would this machine type version relate to e.g. changing the default PCI class of virtio-blk? Would we bump the version number of all machine types can use virtio-blk?
A per-device version number is workable alternative, but only with a saveabi type file IMHO.
I've tried to summarise the options here:
https://fedoraproject.org/wiki/Features/KVM_Stable_Guest_ABI
Cheers,
Mark.
Re: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 7 lines · Mark McLoughlin
Quoted 5 lines · Anthony Liguori
Quoted 2 lines
Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
(quoted diff) +0
-2-M pc1 -M pc2
Quoted 9 lines
Quoted 4 lines
etc.
This is pretty easy to maintain with config files.
I think this would be reasonable, but it is essentially just a version number which you objected to on the basis that it would make cherry-picking harder for distros.
It doesn't have to be pc1, pc2. It could be pc-with-usb or pc-with-balloon. If a distro cherry picks in such a way that their pc is not a standard QEMU pc, they would add a new PC type that's specific to their distro.
Quoted 5 lines
One thing that would be nice with this '-M pc1' thing would be to retain '-M pc' as a symlink to the latest version. We'd also need a way to read the symlink too, so that you can query what the current latest version is and use that in future.
Another option is an explicit -M default which always uses the default machine for the architecture. Likewise, we would need a way to query what the default machine was for an architecture.
Quoted 4 lines
How would this machine type version relate to e.g. changing the default PCI class of virtio-blk? Would we bump the version number of all machine types can use virtio-blk?
You would introduce a new machine type. For instance, pc-virtio-class-other. The names don't have to look like that, I'm just doing that to make a point. This may mean that you end up with dozens of machine types but you preserve compatibility, which is a good thing.
Of course, the flip side is that you make preserving the machine config the duty of the user and we don't maintain compatible machine types. This won't work without a proper config file though so for now, we're stuck maintaining machine types.
Regards,
Anthony Liguori
Michael S. Tsirkin
maintainerRe: Configuration vs. compat hints [was Re: [Qemu-devel] [PATCHv3 03/13] qemu: add routines to manage PCI capabilities]
Quoted 36 lines · Anthony Liguori
Quoted 10 lines · Mark McLoughlin
Quoted 8 lines · Anthony Liguori
Quoted 5 lines
Eventually the default configuration becomes increasingly unusable and you need a new baseline. You must still be able to fall back to the old baseline for older guests. I don't think games with configuration files can hide that.
(quoted diff) +0
-2-M pc1 -M pc2Quoted 9 lines
Quoted 4 lines
etc.
This is pretty easy to maintain with config files.
I think this would be reasonable, but it is essentially just a version number which you objected to on the basis that it would make cherry-picking harder for distros.
It doesn't have to be pc1, pc2. It could be pc-with-usb or pc-with-balloon. If a distro cherry picks in such a way that their pc is not a standard QEMU pc, they would add a new PC type that's specific to their distro.
Quoted 5 lines
One thing that would be nice with this '-M pc1' thing would be to retain '-M pc' as a symlink to the latest version. We'd also need a way to read the symlink too, so that you can query what the current latest version is and use that in future.
Another option is an explicit -M default which always uses the default machine for the architecture. Likewise, we would need a way to query what the default machine was for an architecture.
Quoted 8 lines
Quoted 4 lines
How would this machine type version relate to e.g. changing the default PCI class of virtio-blk? Would we bump the version number of all machine types can use virtio-blk?
You would introduce a new machine type. For instance, pc-virtio-class-other. The names don't have to look like that, I'm just doing that to make a point. This may mean that you end up with dozens of machine types but you preserve compatibility, which is a good thing.
And then pc-virtio-class-other-with-balloon-without-usb? Wouldn't it be more straightforward to have capability bits which can be switched on and off independently rather than trying to fit unrelated features into a machine type? IMO it only seems more work at first, and QA gets a bit nervious that they can't exhaustively test all options. But in the long run it simplifies things as you don't have to set policy and invent silly names.
Quoted 8 lines
Of course, the flip side is that you make preserving the machine config the duty of the user and we don't maintain compatible machine types. This won't work without a proper config file though so for now, we're stuck maintaining machine types.
Regards,
Anthony Liguori