pc,pci,virtio fixes and cleanups
[Qemu-devel] [PULL 01/14] pc: cleanup 1.4 compat support
In reply to Michael S. TsirkinMake 1.4 compat code call the 1.6 one, reducing code duplication. Add comment explaining why we can't make 1.4 call 1.5 as usual.
--- hw/i386/pc_piix.c | 4 ++-- hw/i386/pc_q35.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/i386/pc_piix.c +2 -2
@@ -265,8 +265,8 @@ static void pc_init_pci_1_4(QEMUMachineInitArgs *args) {x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); - has_pci_info = false; -pc_init_pci (args); +/* 1.5 was special - it enabled pvpanic in builtin machine */ +pc_init_pci_1_6 (args); }static void pc_init_pci_1_3 (QEMUMachineInitArgs *args)
hw/i386/pc_q35.c +2 -2
@@ -234,8 +234,8 @@ static void pc_q35_init_1_4(QEMUMachineInitArgs *args) {x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); - has_pci_info = false; -pc_q35_init (args); +/* 1.5 was special - it enabled pvpanic in builtin machine */ +pc_q35_init_1_6 (args); }static QEMUMachine pc_q35_machine_v1_6 = {
Signature · 1 line
MST
The following changes since commit ecfe10c9a6f9bc77d0e4b7eb5d0f5d61e8fbaed8:
Merge remote-tracking branch 'pmaydell/tags/pull-target-arm-20130820' into staging (2013-08-20 11:23:52 -0500)
are available in the git repository at:
git://git.kernel.org/pub/scm/virt/kvm/mst/qemu.git tags/for_anthony
for you to fetch changes up to 1ae2757c6c4525c9b42f408c86818f843bad7418:
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table (2013-08-25 12:52:33 +0300)
----------------------------------------------------------------
pc,pci,virtio fixes and cleanups
This includes pc and pci cleanups, future-proofing of ROM files, and a virtio bugfix correcting splice on virtio console.
----------------------------------------------------------------
Alex Williamson (1):
q35: Add PCIe switch to example q35 configuration
Eduardo Habkost (4):
pc: Kill pc_init_pci_1_0()
pc: Create pc_compat_*() functions
pc: pc_compat_1_4() now can call pc_compat_1_5()
pc_piix: Kill pc_init1() memory region args
Markus Armbruster (5):
sun4: Don't prematurely explode QEMUMachineInitArgs
ppc: Don't explode QEMUMachineInitArgs into local variables needlessly
ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params
pc: Don't prematurely explode QEMUMachineInitArgs
pc: Don't explode QEMUMachineInitArgs into local variables needlessly
Michael S. Tsirkin (3):
pc: cleanup 1.4 compat support
arch_init: align MR size to target page size
loader: store FW CFG ROM files in RAM
yinyin (1):
virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table
arch_init.c | 3 +- docs/q35-chipset.cfg | 23 +++++++++ hw/core/loader.c | 49 +++++++++++++++++-- hw/i386/pc_piix.c | 129 ++++++++++++++++++++++++--------------------------- hw/i386/pc_q35.c | 53 +++++++++++++-------- hw/ppc/e500.c | 35 +++++++------- hw/ppc/e500.h | 13 ++---- hw/ppc/e500plat.c | 14 +----- hw/ppc/mpc8544ds.c | 14 +----- hw/sparc/sun4m.c | 113 ++++++++++---------------------------------- hw/sparc64/sun4u.c | 52 ++++++--------------- hw/virtio/virtio.c | 2 +- include/hw/loader.h | 1 + 13 files changed, 231 insertions(+), 270 deletions(-)
[Qemu-devel] [PULL 02/14] arch_init: align MR size to target page size
Migration code assumes that each MR is a multiple of TARGET_PAGE_SIZE:
MR size is divided by TARGET_PAGE_SIZE, so if it isn't migration never completes.
But this isn't really required for regions set up with memory_region_init_ram, since that calls qemu_ram_alloc which aligns size up using TARGET_PAGE_ALIGN.
Align MR size up to full target page sizes, this way migration completes even if we create a RAM MR which is not a full target page size.
--- arch_init.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch_init.c +2 -1
@@ -342,7 +342,8 @@ ram_addr_t migration_bitmap_find_and_reset_dirty(MemoryRegion *mr, {unsigned long base = mr->ram_addr >>TARGET_PAGE_BITS ;unsigned long nr = base + (start >>TARGET_PAGE_BITS ); -unsigned long size = base + (int128_get64 (mr->size) >>TARGET_PAGE_BITS ); +uint64_t mr_size =TARGET_PAGE_ALIGN (memory_region_size (mr)); +unsigned long size = base + (mr_size >>TARGET_PAGE_BITS );unsigned long next;
Signature · 1 line
MST
[Qemu-devel] [PULL 03/14] loader: store FW CFG ROM files in RAM
In reply to Michael S. TsirkinROM files that are put in FW CFG are copied to guest ram, by BIOS, but they are not backed by RAM so they don't get migrated.
Each time we change two bytes in such a ROM this breaks cross-version
migration: since we can migrate after BIOS has read the first byte but before it has read the second one, getting an inconsistent state.
Future-proof this by creating, for each such ROM,
an MR serving as the backing store.
This MR is never mapped into guest memory, but it's registered as RAM so it's migrated with the guest.
Naturally, this only helps for -M 1.7 and up, older machine types will still have the cross-version migration bug. Luckily the race window for the problem to trigger is very small, which is also likely why we didn't notice the cross-version migration bug in testing yet.
--- hw/core/loader.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- hw/i386/pc_piix.c | 2 ++ hw/i386/pc_q35.c | 2 ++ include/hw/loader.h | 1 + 4 files changed, 51 insertions(+), 3 deletions(-)
hw/core/loader.c +46 -3
@@ -54,6 +54,8 @@#include <zlib.h> +bool rom_file_in_ram = true; +static int roms_loaded;/* return the size or -1 if error */
@@ -576,6 +578,7 @@ struct Rom {size_t datasize;uint8_t *data; +MemoryRegion *mr;int isrom;char *fw_dir;char *fw_file;
@@ -605,6 +608,21 @@ static void rom_insert(Rom *rom)QTAILQ_INSERT_TAIL (&roms, rom, next); } +static void *rom_set_mr (Rom *rom,Object *owner,const char *name) +{ +void *data; + + rom->mr =g_malloc (sizeof (*rom->mr)); +memory_region_init_ram (rom->mr, owner, name, rom->datasize); +memory_region_set_readonly (rom->mr, true); +vmstate_register_ram_global (rom->mr); + + data =memory_region_get_ram_ptr (rom->mr); +memcpy (data, rom->data, rom->datasize); + +return data; +} +int rom_add_file (const char *file,const char *fw_dir,hwaddr addr,int32_t bootindex) {
@@ -646,6 +664,7 @@ int rom_add_file(const char *file, const char *fw_dir,if (rom->fw_file && fw_cfg) {const char *basename;char fw_file_name[56 ]; +void *data; basename =strrchr (rom->fw_file,'/' );if (basename) {
@@ -655,8 +674,15 @@ int rom_add_file(const char *file, const char *fw_dir, }snprintf (fw_file_name,sizeof (fw_file_name),"%s/%s" , rom->fw_dir, basename); -fw_cfg_add_file (fw_cfg, fw_file_name, rom->data, rom->romsize);snprintf (devpath,sizeof (devpath),"/rom@%s" , fw_file_name); + +if (rom_file_in_ram) { + data =rom_set_mr (rom,OBJECT (fw_cfg), devpath); + }else { + data = rom->data; + } + +fw_cfg_add_file (fw_cfg, fw_file_name, data, rom->romsize); }else {snprintf (devpath,sizeof (devpath),"/rom@" TARGET_FMT_plx, addr); }
@@ -731,7 +757,12 @@ static void rom_reset(void *unused)if (rom->data ==NULL ) {continue ; } -cpu_physical_memory_write_rom (rom->addr, rom->data, rom->datasize); +if (rom->mr) { +void *host =memory_region_get_ram_ptr (rom->mr); +memcpy (host, rom->data, rom->datasize); + }else { +cpu_physical_memory_write_rom (rom->addr, rom->data, rom->datasize); + }if (rom->isrom) {/* rom needs to be written only once */ g_free (rom->data);
@@ -781,6 +812,9 @@ static Rom *find_rom(hwaddr addr)if (rom->fw_file) {continue ; } +if (rom->mr) { +continue ; + }if (rom->addr > addr) {continue ; }
@@ -808,6 +842,9 @@ int rom_copy(uint8_t *dest, hwaddr addr, size_t size)if (rom->fw_file) {continue ; } +if (rom->mr) { +continue ; + }if (rom->addr + rom->romsize < addr) {continue ; }
@@ -866,7 +903,13 @@ void do_info_roms(Monitor *mon, const QDict *qdict)Rom *rom; QTAILQ_FOREACH(rom, &roms, next) { -if (!rom->fw_file) { +if (rom->mr) { +monitor_printf (mon,"%s" +" size=0x%06zx name=\"%s\"\n" , + rom->mr->name, + rom->romsize, + rom->name); + }else if (!rom->fw_file) { monitor_printf(mon, "addr=" TARGET_FMT_plx " size=0x%06zx mem=%s name=\"%s\"\n", rom->addr, rom->romsize,
hw/i386/pc_piix.c +2 -0
@@ -25,6 +25,7 @@#include <glib.h> #include "hw/hw.h" +#include "hw/loader.h" #include "hw/i386/pc.h" #include "hw/i386/apic.h" #include "hw/pci/pci.h"
@@ -252,6 +253,7 @@ static void pc_init_pci(QEMUMachineInitArgs *args)static void pc_init_pci_1_6 (QEMUMachineInitArgs *args) { has_pci_info = false; + rom_file_in_ram = false;pc_init_pci (args); }
hw/i386/pc_q35.c +2 -0
@@ -28,6 +28,7 @@* THE SOFTWARE. */ #include "hw/hw.h" +#include "hw/loader.h" #include "sysemu/arch_init.h" #include "hw/i2c/smbus.h" #include "hw/boards.h"
@@ -221,6 +222,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args)static void pc_q35_init_1_6 (QEMUMachineInitArgs *args) { has_pci_info = false; + rom_file_in_ram = false;pc_q35_init (args); }
include/hw/loader.h +1 -0
@@ -36,6 +36,7 @@ void pstrcpy_targphys(const char *name, hwaddr dest, int buf_size, const char *source); +extern bool rom_file_in_ram;int rom_add_file (const char *file,const char *fw_dir,hwaddr addr,int32_t bootindex);
Signature · 1 line
MST
[Qemu-devel] [PULL 04/14] q35: Add PCIe switch to example q35 configuration
In reply to Michael S. TsirkinFrom: Alex Williamson <[email protected]>
--- docs/q35-chipset.cfg | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
docs/q35-chipset.cfg +23 -0
@@ -91,6 +91,29 @@ port = "4" chassis = "4" +## +# Example PCIe switch with two downstream ports +# +#[device "pcie-switch-upstream-port-1"] +# driver = "x3130-upstream" +# bus = "ich9-pcie-port-4" +# addr = "00.0" +# +#[device "pcie-switch-downstream-port-1-1"] +# driver = "xio3130-downstream" +# multifunction = "on" +# bus = "pcie-switch-upstream-port-1" +# addr = "00.0" +# port = "1" +# chassis = "5" +# +#[device "pcie-switch-downstream-port-1-2"] +# driver = "xio3130-downstream" +# multifunction = "on" +# bus = "pcie-switch-upstream-port-1" +# addr = "00.1" +# port = "1" +# chassis = "6" [device "ich9-ehci-1"] driver = "ich9-usb-ehci1"
Signature · 1 line
MST
[Qemu-devel] [PULL 05/14] sun4: Don't prematurely explode QEMUMachineInitArgs
In reply to Michael S. TsirkinFrom: Markus Armbruster <[email protected]>
Don't explode QEMUMachineInitArgs before passing it to sun4m_hw_init(), sun4uv_init().
--- hw/sparc/sun4m.c | 113 ++++++++++++----------------------------------------- hw/sparc64/sun4u.c | 52 +++++++----------------- 2 files changed, 40 insertions(+), 125 deletions(-)
hw/sparc/sun4m.c +25 -88
@@ -836,12 +836,10 @@ static void dummy_fdc_tc(void *opaque, int irq, int level) { } -static void sun4m_hw_init (const struct sun4m_hwdef *hwdef,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) +static void sun4m_hw_init (const struct sun4m_hwdef *hwdef, +QEMUMachineInitArgs *args) { +const char *cpu_model = args->cpu_model;unsigned int i;void *iommu, *espdma, *ledma, *nvram; qemu_irq *cpu_irqs[MAX_CPUS], slavio_irq[32], slavio_cpu_irq[MAX_CPUS],
@@ -867,10 +865,10 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,/* set up devices */ -ram_init (0 , RAM_size, hwdef->max_mem); +ram_init (0 , args->ram_size, hwdef->max_mem);/* models without ECC don't trap when missing ram is accessed */ if (!hwdef->ecc_base) { -empty_slot_init (RAM_size, hwdef->max_mem - RAM_size); +empty_slot_init (args->ram_size, hwdef->max_mem - args->ram_size); }prom_init (hwdef->slavio_base, bios_name);
@@ -993,11 +991,12 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,empty_slot_init (hwdef->bpp_base,0x20 ); } - kernel_size =sun4m_load_kernel (kernel_filename, initrd_filename, - RAM_size); + kernel_size =sun4m_load_kernel (args->kernel_filename, + args->initrd_filename, + args->ram_size); -nvram_init (nvram, (uint8_t *)&nd_table[0 ].macaddr, kernel_cmdline, - boot_device, RAM_size, kernel_size, graphic_width, +nvram_init (nvram, (uint8_t *)&nd_table[0 ].macaddr, args->kernel_cmdline, + args->boot_device, args->ram_size, kernel_size, graphic_width, graphic_height, graphic_depth, hwdef->nvram_machine_id,"Sun4m" );
@@ -1015,19 +1014,20 @@ static void sun4m_hw_init(const struct sun4m_hwdef *hwdef, ram_addr_t RAM_size,fw_cfg_add_i16 (fw_cfg,FW_CFG_SUN4M_HEIGHT , graphic_height);fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_ADDR ,KERNEL_LOAD_ADDR );fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_SIZE , kernel_size); -if (kernel_cmdline) { +if (args->kernel_cmdline) {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,CMDLINE_ADDR ); -pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , kernel_cmdline); -fw_cfg_add_string (fw_cfg,FW_CFG_CMDLINE_DATA , kernel_cmdline); +pstrcpy_targphys ("cmdline" ,CMDLINE_ADDR ,TARGET_PAGE_SIZE , + args->kernel_cmdline); +fw_cfg_add_string (fw_cfg,FW_CFG_CMDLINE_DATA , args->kernel_cmdline);fw_cfg_add_i32 (fw_cfg,FW_CFG_CMDLINE_SIZE , -strlen (kernel_cmdline) +1 ); +strlen (args->kernel_cmdline) +1 ); }else {fw_cfg_add_i32 (fw_cfg,FW_CFG_KERNEL_CMDLINE ,0 );fw_cfg_add_i32 (fw_cfg,FW_CFG_CMDLINE_SIZE ,0 ); }fw_cfg_add_i32 (fw_cfg,FW_CFG_INITRD_ADDR ,INITRD_LOAD_ADDR );fw_cfg_add_i32 (fw_cfg,FW_CFG_INITRD_SIZE ,0 );// not used -fw_cfg_add_i16 (fw_cfg,FW_CFG_BOOT_DEVICE , boot_device[0 ]); +fw_cfg_add_i16 (fw_cfg,FW_CFG_BOOT_DEVICE , args->boot_device[0 ]);qemu_register_boot_set (fw_cfg_boot_set, fw_cfg); }
@@ -1291,118 +1291,55 @@ static const struct sun4m_hwdef sun4m_hwdefs[] = {/* SPARCstation 5 hardware initialisation */ static void ss5_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[0 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[0 ], args); }/* SPARCstation 10 hardware initialisation */ static void ss10_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[1 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[1 ], args); }/* SPARCserver 600MP hardware initialisation */ static void ss600mp_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[2 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[2 ], args); }/* SPARCstation 20 hardware initialisation */ static void ss20_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[3 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[3 ], args); }/* SPARCstation Voyager hardware initialisation */ static void vger_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[4 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[4 ], args); }/* SPARCstation LX hardware initialisation */ static void ss_lx_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[5 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[5 ], args); }/* SPARCstation 4 hardware initialisation */ static void ss4_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[6 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[6 ], args); }/* SPARCClassic hardware initialisation */ static void scls_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[7 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[7 ], args); }/* SPARCbook hardware initialisation */ static void sbook_init (QEMUMachineInitArgs *args) { -ram_addr_t RAM_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -sun4m_hw_init (&sun4m_hwdefs[8 ], RAM_size, boot_device, kernel_filename, - kernel_cmdline, initrd_filename, cpu_model); +sun4m_hw_init (&sun4m_hwdefs[8 ], args); }static QEMUMachine ss5_machine = {
hw/sparc64/sun4u.c +15 -37
104 lines not on this page · raw message
Signature · 1 line
MST
[Qemu-devel] [PULL 06/14] ppc: Don't explode QEMUMachineInitArgs into local variables needlessly
In reply to Michael S. TsirkinFrom: Markus Armbruster <[email protected]>
Don't explode when the variable is used just once, and never changed.
--- hw/ppc/e500plat.c | 18 ++++++------------ hw/ppc/mpc8544ds.c | 18 ++++++------------ 2 files changed, 12 insertions(+), 24 deletions(-)
hw/ppc/e500plat.c +6 -12
@@ -30,19 +30,13 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)static void e500plat_init (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *boot_device = args->boot_device; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename;PPCE500Params params = { - .ram_size = ram_size, - .boot_device = boot_device, - .kernel_filename = kernel_filename, - .kernel_cmdline = kernel_cmdline, - .initrd_filename = initrd_filename, - .cpu_model = cpu_model, + .ram_size = args->ram_size, + .boot_device = args->boot_device, + .kernel_filename = args->kernel_filename, + .kernel_cmdline = args->kernel_cmdline, + .initrd_filename = args->initrd_filename, + .cpu_model = args->cpu_model, .pci_first_slot =0x1 , .pci_nr_slots =PCI_SLOT_MAX -1 , .fixup_devtree = e500plat_fixup_devtree,
hw/ppc/mpc8544ds.c +6 -12
@@ -28,19 +28,13 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)static void mpc8544ds_init (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *boot_device = args->boot_device; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename;PPCE500Params params = { - .ram_size = ram_size, - .boot_device = boot_device, - .kernel_filename = kernel_filename, - .kernel_cmdline = kernel_cmdline, - .initrd_filename = initrd_filename, - .cpu_model = cpu_model, + .ram_size = args->ram_size, + .boot_device = args->boot_device, + .kernel_filename = args->kernel_filename, + .kernel_cmdline = args->kernel_cmdline, + .initrd_filename = args->initrd_filename, + .cpu_model = args->cpu_model, .pci_first_slot =0x11 , .pci_nr_slots =2 , .fixup_devtree = mpc8544ds_fixup_devtree,
Signature · 1 line
MST
[Qemu-devel] [PULL 07/14] ppc: Don't duplicate QEMUMachineInitArgs in PPCE500Params
In reply to Michael S. TsirkinFrom: Markus Armbruster <[email protected]>
Pass on the generic arguments unadulterated, and the machine-specific ones as separate argument.
--- hw/ppc/e500.c | 35 ++++++++++++++++++----------------- hw/ppc/e500.h | 13 +++---------- hw/ppc/e500plat.c | 8 +------- hw/ppc/mpc8544ds.c | 8 +------- 4 files changed, 23 insertions(+), 41 deletions(-)
hw/ppc/e500.c +18 -17
@@ -124,13 +124,14 @@ static void dt_serial_create(void *fdt, unsigned long long offset, }static int ppce500_load_device_tree (CPUPPCState *env, +QEMUMachineInitArgs *args,PPCE500Params *params,hwaddr addr,hwaddr initrd_base,hwaddr initrd_size) {int ret =-1 ; -uint64_t mem_reg_property[] = {0 ,cpu_to_be64 (params->ram_size) }; +uint64_t mem_reg_property[] = {0 ,cpu_to_be64 (args->ram_size) };int fdt_size;void *fdt;uint8_t hypercall[16 ];
@@ -205,7 +206,7 @@ static int ppce500_load_device_tree(CPUPPCState *env, } ret =qemu_devtree_setprop_string (fdt,"/chosen" ,"bootargs" , - params->kernel_cmdline); + args->kernel_cmdline);if (ret <0 )fprintf (stderr,"couldn't set /chosen/bootargs\n" );
@@ -559,7 +560,7 @@ static qemu_irq *ppce500_init_mpic(PPCE500Params *params, MemoryRegion *ccsr,return mpic; } -void ppce500_init (PPCE500Params *params) +void ppce500_init (QEMUMachineInitArgs *args,PPCE500Params *params) {MemoryRegion *address_space_mem =get_system_memory ();MemoryRegion *ram =g_new (MemoryRegion,1 );
@@ -584,8 +585,8 @@ void ppce500_init(PPCE500Params *params)PPCE500CCSRState *ccsr;/* Setup CPUs */ -if (params->cpu_model ==NULL ) { - params->cpu_model ="e500v2_v30" ; +if (args->cpu_model ==NULL ) { + args->cpu_model ="e500v2_v30" ; } irqs =g_malloc0 (smp_cpus *sizeof (qemu_irq *));
@@ -595,7 +596,7 @@ void ppce500_init(PPCE500Params *params)CPUState *cs;qemu_irq *input; - cpu =cpu_ppc_init (params->cpu_model); + cpu =cpu_ppc_init (args->cpu_model);if (cpu ==NULL ) {fprintf (stderr,"Unable to initialize CPU!\n" );exit (1 );
@@ -634,7 +635,7 @@ void ppce500_init(PPCE500Params *params)/* Fixup Memory size on a alignment boundary */ ram_size &= ~(RAM_SIZES_ALIGN -1 ); - params->ram_size = ram_size; + args->ram_size = ram_size;/* Register Memory */ memory_region_init_ram (ram,NULL ,"mpc8544ds.ram" , ram_size);
@@ -701,11 +702,11 @@ void ppce500_init(PPCE500Params *params)sysbus_create_simple ("e500-spin" ,MPC8544_SPIN_BASE ,NULL );/* Load kernel. */ -if (params->kernel_filename) { - kernel_size =load_uimage (params->kernel_filename, &entry, +if (args->kernel_filename) { + kernel_size =load_uimage (args->kernel_filename, &entry, &loadaddr,NULL );if (kernel_size <0 ) { - kernel_size =load_elf (params->kernel_filename,NULL ,NULL , + kernel_size =load_elf (args->kernel_filename,NULL ,NULL , &elf_entry, &elf_lowaddr,NULL ,1 ,ELF_MACHINE ,0 ); entry = elf_entry;
@@ -714,7 +715,7 @@ void ppce500_init(PPCE500Params *params)/* XXX try again as binary */ if (kernel_size <0 ) {fprintf (stderr,"qemu: could not load kernel '%s'\n" , - params->kernel_filename); + args->kernel_filename);exit (1 ); }
@@ -726,14 +727,14 @@ void ppce500_init(PPCE500Params *params) }/* Load initrd. */ -if (params->initrd_filename) { +if (args->initrd_filename) { initrd_base = (cur_base +INITRD_LOAD_PAD ) & ~INITRD_PAD_MASK ; - initrd_size =load_image_targphys (params->initrd_filename, initrd_base, + initrd_size =load_image_targphys (args->initrd_filename, initrd_base, ram_size - initrd_base);if (initrd_size <0 ) {fprintf (stderr,"qemu: could not load initial ram disk '%s'\n" , - params->initrd_filename); + args->initrd_filename);exit (1 ); }
@@ -741,12 +742,12 @@ void ppce500_init(PPCE500Params *params) }/* If we're loading a kernel directly, we must load the device tree too. */ -if (params->kernel_filename) { +if (args->kernel_filename) {struct boot_info *boot_info;int dt_size; - dt_size =ppce500_load_device_tree (env, params, dt_base, initrd_base, - initrd_size); + dt_size =ppce500_load_device_tree (env, args, params, dt_base, + initrd_base, initrd_size);if (dt_size <0 ) {fprintf (stderr,"couldn't load device tree\n" );exit (1 );
hw/ppc/e500.h +3 -10
@@ -1,25 +1,18 @@#ifndef PPCE500_H #define PPCE500_H +#include "hw/boards.h" +typedef struct PPCE500Params { -/* Standard QEMU machine init params */ -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;int pci_first_slot;int pci_nr_slots; -/* e500-specific params */ -/* required -- must at least add toplevel board compatible */ void (*fixup_devtree)(struct PPCE500Params *params,void *fdt);int mpic_version; }PPCE500Params ; -void ppce500_init (PPCE500Params *params); +void ppce500_init (QEMUMachineInitArgs *args,PPCE500Params *params);#endif
hw/ppc/e500plat.c +1 -7
@@ -31,12 +31,6 @@ static void e500plat_fixup_devtree(PPCE500Params *params, void *fdt)static void e500plat_init (QEMUMachineInitArgs *args) {PPCE500Params params = { - .ram_size = args->ram_size, - .boot_device = args->boot_device, - .kernel_filename = args->kernel_filename, - .kernel_cmdline = args->kernel_cmdline, - .initrd_filename = args->initrd_filename, - .cpu_model = args->cpu_model, .pci_first_slot =0x1 , .pci_nr_slots =PCI_SLOT_MAX -1 , .fixup_devtree = e500plat_fixup_devtree,
@@ -49,7 +43,7 @@ static void e500plat_init(QEMUMachineInitArgs *args) params.mpic_version =OPENPIC_MODEL_FSL_MPIC_20 ; } -ppce500_init (¶ms); +ppce500_init (args, ¶ms); }static QEMUMachine e500plat_machine = {
hw/ppc/mpc8544ds.c +1 -7
@@ -29,19 +29,13 @@ static void mpc8544ds_fixup_devtree(PPCE500Params *params, void *fdt)static void mpc8544ds_init (QEMUMachineInitArgs *args) {PPCE500Params params = { - .ram_size = args->ram_size, - .boot_device = args->boot_device, - .kernel_filename = args->kernel_filename, - .kernel_cmdline = args->kernel_cmdline, - .initrd_filename = args->initrd_filename, - .cpu_model = args->cpu_model, .pci_first_slot =0x11 , .pci_nr_slots =2 , .fixup_devtree = mpc8544ds_fixup_devtree, .mpic_version =OPENPIC_MODEL_FSL_MPIC_20 , }; -ppce500_init (¶ms); +ppce500_init (args, ¶ms); }
Signature · 1 line
MST
[Qemu-devel] [PULL 08/14] pc: Don't prematurely explode QEMUMachineInitArgs
In reply to Michael S. TsirkinFrom: Markus Armbruster <[email protected]>
Don't explode QEMUMachineInitArgs before passing it to pc_init1().
--- hw/i386/pc_piix.c | 65 ++++++++++++++----------------------------------------- 1 file changed, 16 insertions(+), 49 deletions(-)
hw/i386/pc_piix.c +16 -49
@@ -61,14 +61,9 @@ static bool has_pvpanic;static bool has_pci_info = true;/* PC hardware initialisation */ -static void pc_init1 (MemoryRegion *system_memory, +static void pc_init1 (QEMUMachineInitArgs *args, +MemoryRegion *system_memory,MemoryRegion *system_io, -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,int pci_enabled,int kvmclock_enabled) {
@@ -103,18 +98,18 @@ static void pc_init1(MemoryRegion *system_memory,object_property_add_child (qdev_get_machine (),"icc-bridge" ,OBJECT (icc_bridge),NULL ); -pc_cpus_init (cpu_model, icc_bridge); +pc_cpus_init (args->cpu_model, icc_bridge);if (kvm_enabled () && kvmclock_enabled) {kvmclock_create (); } -if (ram_size >=0xe0000000 ) { - above_4g_mem_size = ram_size -0xe0000000 ; +if (args->ram_size >=0xe0000000 ) { + above_4g_mem_size = args->ram_size -0xe0000000 ; below_4g_mem_size =0xe0000000 ; }else { above_4g_mem_size =0 ; - below_4g_mem_size = ram_size; + below_4g_mem_size = args->ram_size; }if (pci_enabled) {
@@ -133,7 +128,8 @@ static void pc_init1(MemoryRegion *system_memory,/* allocate ram and load rom/bios */ if (!xen_enabled ()) { fw_cfg =pc_memory_init (system_memory, - kernel_filename, kernel_cmdline, initrd_filename, + args->kernel_filename, args->kernel_cmdline, + args->initrd_filename, below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); }
@@ -149,7 +145,7 @@ static void pc_init1(MemoryRegion *system_memory,if (pci_enabled) { pci_bus = i440fx_init(&i440fx_state, &piix3_devfn, &isa_bus, gsi, - system_memory, system_io, ram_size, + system_memory, system_io, args->ram_size, below_4g_mem_size, 0x100000000ULL - below_4g_mem_size, above_4g_mem_size,
@@ -208,7 +204,7 @@ static void pc_init1(MemoryRegion *system_memory, } } -pc_cmos_init (below_4g_mem_size, above_4g_mem_size, boot_device, +pc_cmos_init (below_4g_mem_size, above_4g_mem_size, args->boot_device, floppy, idebus[0 ], idebus[1 ], rtc_state);if (pci_enabled &&usb_enabled (false)) {
@@ -237,17 +233,7 @@ static void pc_init1(MemoryRegion *system_memory,static void pc_init_pci (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; -pc_init1 (get_system_memory (), -get_system_io (), - ram_size, boot_device, - kernel_filename, kernel_cmdline, - initrd_filename, cpu_model,1 ,1 ); +pc_init1 (args,get_system_memory (),get_system_io (),1 ,1 ); }static void pc_init_pci_1_6 (QEMUMachineInitArgs *args)
@@ -293,40 +279,21 @@ static void pc_init_pci_1_0(QEMUMachineInitArgs *args)/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ static void pc_init_pci_no_kvmclock (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; has_pci_info = false;disable_kvm_pv_eoi ();enable_compat_apic_id_mode (); -pc_init1 (get_system_memory (), -get_system_io (), - ram_size, boot_device, - kernel_filename, kernel_cmdline, - initrd_filename, cpu_model,1 ,0 ); +pc_init1 (args,get_system_memory (),get_system_io (),1 ,0 ); }static void pc_init_isa (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device; has_pci_info = false; -if (cpu_model ==NULL ) - cpu_model ="486" ; +if (!args->cpu_model) { + args->cpu_model ="486" ; + }disable_kvm_pv_eoi ();enable_compat_apic_id_mode (); -pc_init1 (get_system_memory (), -get_system_io (), - ram_size, boot_device, - kernel_filename, kernel_cmdline, - initrd_filename, cpu_model,0 ,1 ); +pc_init1 (args,get_system_memory (),get_system_io (),0 ,1 ); }#ifdef CONFIG_XEN
Signature · 1 line
MST
[Qemu-devel] [PULL 09/14] pc: Don't explode QEMUMachineInitArgs into local variables needlessly
In reply to Michael S. TsirkinFrom: Markus Armbruster <[email protected]>
Don't explode when the variable is used just a few times, and never changed.
--- hw/i386/pc_q35.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-)
hw/i386/pc_q35.c +9 -13
@@ -53,12 +53,6 @@ static bool has_pci_info = true;/* PC hardware initialisation */ static void pc_q35_init (QEMUMachineInitArgs *args) { -ram_addr_t ram_size = args->ram_size; -const char *cpu_model = args->cpu_model; -const char *kernel_filename = args->kernel_filename; -const char *kernel_cmdline = args->kernel_cmdline; -const char *initrd_filename = args->initrd_filename; -const char *boot_device = args->boot_device;ram_addr_t below_4g_mem_size, above_4g_mem_size;Q35PCIHost *q35_host;PCIHostState *phb;
@@ -86,17 +80,17 @@ static void pc_q35_init(QEMUMachineInitArgs *args)object_property_add_child (qdev_get_machine (),"icc-bridge" ,OBJECT (icc_bridge),NULL ); -pc_cpus_init (cpu_model, icc_bridge); +pc_cpus_init (args->cpu_model, icc_bridge);pc_acpi_init ("q35-acpi-dsdt.aml" );kvmclock_create (); -if (ram_size >=0xb0000000 ) { - above_4g_mem_size = ram_size -0xb0000000 ; +if (args->ram_size >=0xb0000000 ) { + above_4g_mem_size = args->ram_size -0xb0000000 ; below_4g_mem_size =0xb0000000 ; }else { above_4g_mem_size =0 ; - below_4g_mem_size = ram_size; + below_4g_mem_size = args->ram_size; }/* pci enabled */
@@ -115,8 +109,10 @@ static void pc_q35_init(QEMUMachineInitArgs *args)/* allocate ram and load rom/bios */ if (!xen_enabled ()) { -pc_memory_init (get_system_memory (), kernel_filename, kernel_cmdline, - initrd_filename, below_4g_mem_size, above_4g_mem_size, +pc_memory_init (get_system_memory (), + args->kernel_filename, args->kernel_cmdline, + args->initrd_filename, + below_4g_mem_size, above_4g_mem_size, rom_memory, &ram_memory, guest_info); }
@@ -204,7 +200,7 @@ static void pc_q35_init(QEMUMachineInitArgs *args) 0xb100), 8, NULL, 0); -pc_cmos_init (below_4g_mem_size, above_4g_mem_size, boot_device, +pc_cmos_init (below_4g_mem_size, above_4g_mem_size, args->boot_device, floppy, idebus[0 ], idebus[1 ], rtc_state);/* the rest devices to which pci devfn is automatically assigned */
Signature · 1 line
MST
[Qemu-devel] [PULL 10/14] pc: Kill pc_init_pci_1_0()
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
The pc_init_pci_1_2()/pc_init_pci_1_0() split was made on commit 6fd028f64f662c801fd5a54d0e3a1d2baeee93ea, in preparation for commit 9953f8822cc316eec9962f0a2858c3439a80adec. The latter was reverted, so there's no reason to keep two separate functions that do exactly the same, anymore.
--- hw/i386/pc_piix.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
hw/i386/pc_piix.c +4 -10
@@ -263,19 +263,13 @@ static void pc_init_pci_1_3(QEMUMachineInitArgs *args)pc_init_pci_1_4 (args); } -/* PC machine init function for pc-1.1 to pc-1.2 */ +/* PC machine init function for pc-0.14 to pc-1.2 */ static void pc_init_pci_1_2 (QEMUMachineInitArgs *args) {disable_kvm_pv_eoi ();pc_init_pci_1_3 (args); } -/* PC machine init function for pc-0.14 to pc-1.0 */ -static void pc_init_pci_1_0 (QEMUMachineInitArgs *args) -{ -pc_init_pci_1_2 (args); -} -/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */ static void pc_init_pci_no_kvmclock (QEMUMachineInitArgs *args) {
@@ -485,7 +479,7 @@ static QEMUMachine pc_machine_v1_1 = {static QEMUMachine pc_machine_v1_0 = { .name ="pc-1.0" , .desc ="Standard PC" , - .init = pc_init_pci_1_0, + .init = pc_init_pci_1_2, .max_cpus =255 , .compat_props = (GlobalProperty []) {PC_COMPAT_1_0 ,
@@ -501,7 +495,7 @@ static QEMUMachine pc_machine_v1_0 = {static QEMUMachine pc_machine_v0_15 = { .name ="pc-0.15" , .desc ="Standard PC" , - .init = pc_init_pci_1_0, + .init = pc_init_pci_1_2, .max_cpus =255 , .compat_props = (GlobalProperty []) {PC_COMPAT_0_15 ,
@@ -534,7 +528,7 @@ static QEMUMachine pc_machine_v0_15 = {static QEMUMachine pc_machine_v0_14 = { .name ="pc-0.14" , .desc ="Standard PC" , - .init = pc_init_pci_1_0, + .init = pc_init_pci_1_2, .max_cpus =255 , .compat_props = (GlobalProperty []) {PC_COMPAT_0_14 ,
Signature · 1 line
MST
[Qemu-devel] [PULL 11/14] pc: Create pc_compat_*() functions
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
Making the older compat functions call the newer compat functions at the beginning allows the older functions undo what's done by newer compat functions. e.g.: pc_compat_1_4() will be able to call pc_compat_1_5() and then set has_pvpanic=false.
--- hw/i386/pc_piix.c | 52 +++++++++++++++++++++++++++++++++++++++++----------- hw/i386/pc_q35.c | 31 ++++++++++++++++++++++++------- 2 files changed, 65 insertions(+), 18 deletions(-)
hw/i386/pc_piix.c +41 -11
@@ -236,38 +236,68 @@ static void pc_init_pci(QEMUMachineInitArgs *args)pc_init1 (args,get_system_memory (),get_system_io (),1 ,1 ); } -static void pc_init_pci_1_6 (QEMUMachineInitArgs *args) +static void pc_compat_1_6 (QEMUMachineInitArgs *args) { has_pci_info = false; rom_file_in_ram = false; -pc_init_pci (args); } -static void pc_init_pci_1_5 (QEMUMachineInitArgs *args) +static void pc_compat_1_5 (QEMUMachineInitArgs *args) { +pc_compat_1_6 (args); has_pvpanic = true; -pc_init_pci_1_6 (args); } -static void pc_init_pci_1_4 (QEMUMachineInitArgs *args) +static void pc_compat_1_4 (QEMUMachineInitArgs *args) { +/* 1.5 was special - it enabled pvpanic in builtin machine */ +pc_compat_1_6 (args);x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); -/* 1.5 was special - it enabled pvpanic in builtin machine */ -pc_init_pci_1_6 (args); } -static void pc_init_pci_1_3 (QEMUMachineInitArgs *args) +static void pc_compat_1_3 (QEMUMachineInitArgs *args) { +pc_compat_1_4 (args);enable_compat_apic_id_mode (); -pc_init_pci_1_4 (args); +} + +/* PC compat function for pc-0.14 to pc-1.2 */ +static void pc_compat_1_2 (QEMUMachineInitArgs *args) +{ +pc_compat_1_3 (args); +disable_kvm_pv_eoi (); +} + +static void pc_init_pci_1_6 (QEMUMachineInitArgs *args) +{ +pc_compat_1_6 (args); +pc_init_pci (args); +} + +static void pc_init_pci_1_5 (QEMUMachineInitArgs *args) +{ +pc_compat_1_5 (args); +pc_init_pci (args); +} + +static void pc_init_pci_1_4 (QEMUMachineInitArgs *args) +{ +pc_compat_1_4 (args); +pc_init_pci (args); +} + +static void pc_init_pci_1_3 (QEMUMachineInitArgs *args) +{ +pc_compat_1_3 (args); +pc_init_pci (args); }/* PC machine init function for pc-0.14 to pc-1.2 */ static void pc_init_pci_1_2 (QEMUMachineInitArgs *args) { -disable_kvm_pv_eoi (); -pc_init_pci_1_3 (args); +pc_compat_1_2 (args); +pc_init_pci (args); }/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
hw/i386/pc_q35.c +24 -7
@@ -215,25 +215,42 @@ static void pc_q35_init(QEMUMachineInitArgs *args) } } -static void pc_q35_init_1_6 (QEMUMachineInitArgs *args) +static void pc_compat_1_6 (QEMUMachineInitArgs *args) { has_pci_info = false; rom_file_in_ram = false; -pc_q35_init (args); } -static void pc_q35_init_1_5 (QEMUMachineInitArgs *args) +static void pc_compat_1_5 (QEMUMachineInitArgs *args) { +pc_compat_1_6 (args); has_pvpanic = true; -pc_q35_init_1_6 (args); } -static void pc_q35_init_1_4 (QEMUMachineInitArgs *args) +static void pc_compat_1_4 (QEMUMachineInitArgs *args) { +/* 1.5 was special - it enabled pvpanic in builtin machine */ +pc_compat_1_6 (args);x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); -/* 1.5 was special - it enabled pvpanic in builtin machine */ -pc_q35_init_1_6 (args); +} + +static void pc_q35_init_1_6 (QEMUMachineInitArgs *args) +{ +pc_compat_1_6 (args); +pc_q35_init (args); +} + +static void pc_q35_init_1_5 (QEMUMachineInitArgs *args) +{ +pc_compat_1_5 (args); +pc_q35_init (args); +} + +static void pc_q35_init_1_4 (QEMUMachineInitArgs *args) +{ +pc_compat_1_4 (args); +pc_q35_init (args); }static QEMUMachine pc_q35_machine_v1_6 = {
Signature · 1 line
MST
[Qemu-devel] [PULL 12/14] pc: pc_compat_1_4() now can call pc_compat_1_5()
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
It just needs to set has_pvpanic=false after calling it. This way, it won't be a special case anymore.
--- hw/i386/pc_piix.c | 4 ++-- hw/i386/pc_q35.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
hw/i386/pc_piix.c +2 -2
@@ -250,8 +250,8 @@ static void pc_compat_1_5(QEMUMachineInitArgs *args)static void pc_compat_1_4 (QEMUMachineInitArgs *args) { -/* 1.5 was special - it enabled pvpanic in builtin machine */ -pc_compat_1_6 (args); +pc_compat_1_5 (args); + has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); }
hw/i386/pc_q35.c +2 -2
@@ -229,8 +229,8 @@ static void pc_compat_1_5(QEMUMachineInitArgs *args)static void pc_compat_1_4 (QEMUMachineInitArgs *args) { -/* 1.5 was special - it enabled pvpanic in builtin machine */ -pc_compat_1_6 (args); +pc_compat_1_5 (args); + has_pvpanic = false;x86_cpu_compat_set_features ("n270" ,FEAT_1_ECX ,0 ,CPUID_EXT_MOVBE );x86_cpu_compat_set_features ("Westmere" ,FEAT_1_ECX ,0 ,CPUID_EXT_PCLMULQDQ ); }
Signature · 1 line
MST
[Qemu-devel] [PULL 13/14] pc_piix: Kill pc_init1() memory region args
In reply to Michael S. TsirkinFrom: Eduardo Habkost <[email protected]>
All callers always use the same values (get_system_memory(), get_system_io()), so the parameters are pointless.
If one day we decide to eliminate get_system_memory() and get_system_io(), we will be able to do that more easily by adding the values to struct QEMUMachineInitArgs.
--- hw/i386/pc_piix.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/i386/pc_piix.c +5 -5
@@ -62,11 +62,11 @@ static bool has_pci_info = true;/* PC hardware initialisation */ static void pc_init1 (QEMUMachineInitArgs *args, -MemoryRegion *system_memory, -MemoryRegion *system_io,int pci_enabled,int kvmclock_enabled) { +MemoryRegion *system_memory =get_system_memory (); +MemoryRegion *system_io =get_system_io ();int i;ram_addr_t below_4g_mem_size, above_4g_mem_size;PCIBus *pci_bus;
@@ -233,7 +233,7 @@ static void pc_init1(QEMUMachineInitArgs *args,static void pc_init_pci (QEMUMachineInitArgs *args) { -pc_init1 (args,get_system_memory (),get_system_io (),1 ,1 ); +pc_init1 (args,1 ,1 ); }static void pc_compat_1_6 (QEMUMachineInitArgs *args)
@@ -306,7 +306,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) has_pci_info = false;disable_kvm_pv_eoi ();enable_compat_apic_id_mode (); -pc_init1 (args,get_system_memory (),get_system_io (),1 ,0 ); +pc_init1 (args,1 ,0 ); }static void pc_init_isa (QEMUMachineInitArgs *args)
@@ -317,7 +317,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args) }disable_kvm_pv_eoi ();enable_compat_apic_id_mode (); -pc_init1 (args,get_system_memory (),get_system_io (),0 ,1 ); +pc_init1 (args,0 ,1 ); }#ifdef CONFIG_XEN
Signature · 1 line
MST
[Qemu-devel] [PULL 14/14] virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table
In reply to Michael S. TsirkinFrom: yinyin <[email protected]>
virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it.
/* loop over the indirect descriptor table */
indirect = 1;
max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc);
num_bufs = i = 0;
desc_pa = vring_desc_addr(desc_pa, i);But, It init i to 0, then use i to update desc_pa. so we will always get:desc_pa = vring_desc_addr(desc_pa, 0);
the last two line should swap.
--- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/virtio/virtio.c +1 -1
@@ -377,8 +377,8 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,/* loop over the indirect descriptor table */ indirect =1 ; max =vring_desc_len (desc_pa, i) /sizeof (VRingDesc); - num_bufs = i =0 ; desc_pa =vring_desc_addr (desc_pa, i); + num_bufs = i =0 ; } do {
Signature · 1 line
MST
Amos Kong
Acked-byRe: [Qemu-devel] [PULL 14/14] virtio: virtqueue_get_avail_bytes: fix desc_pa when loop over the indirect descriptor table
Quoted 8 lines · Michael S. Tsirkin
From: yinyin <[email protected]>
virtqueue_get_avail_bytes: when found a indirect desc, we need loop over it./* loop over the indirect descriptor table */ indirect = 1; max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); num_bufs = i = 0; desc_pa = vring_desc_addr(desc_pa, i);
Quoted 8 lines
But, It init i to 0, then use i to update
desc_pa. so we will always get:desc_pa=vring_desc_addr(desc_pa, 0);
the last two line should swap.Signed-off-by Yin Yin <[email protected]>Reviewed-by Stefan Hajnoczi <[email protected]>Signed-off-by Michael S. Tsirkin <[email protected]>
Quoted 21 lines
--- hw/virtio/virtio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)hw/virtio/virtio.c +1
-1@@ -377,8 +377,8 @@ void virtqueue_get_avail_bytes(VirtQueue *vq, unsigned int *in_bytes,/* loop over the indirect descriptor table */ indirect =1 ; max =vring_desc_len (desc_pa, i) /sizeof (VRingDesc); - num_bufs = i =0 ; desc_pa =vring_desc_addr (desc_pa, i); + num_bufs = i =0 ; } do {Signature · 1 line
MST
Signature · 1 line
Amos.