Pending pseries/ppc patches as at 1.3 release
cover Pending pseries/ppc patches as at 1.3 release
Here's my currently pending set of ready-to-go patches for the pseries machine. A number of these were sent before and may be in the ppc-next tree, but did not make it into 1.3. 10-13 however, are new patches, or at least reworkings of patches that were rejected in their original form.
Alex, please apply.
PATCH 1/13 pseries: Fix incorrect initialization of interrupt controller
Currently in the reset code for the XICS interrupt controller, we initialize the pending_priority field to 0 (most favored, by XICS convention). This is incorrect, since there is no pending interrupt, it should be set to least favored - 0xff. At the moment our XICS implementation doesn't get hurt by this edge case, but it does confuse the upcoming kernel XICS implementation.
--- hw/xics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/xics.c +1 -1
@@ -495,7 +495,7 @@ static void xics_reset(void *opaque)for (i =0 ; i < icp->nr_servers; i++) { icp->ss[i].xirr =0 ; - icp->ss[i].pending_priority =0 ; + icp->ss[i].pending_priority =0xff ; icp->ss[i].mfrr =0xff ;/* Make all outputs are deasserted */ qemu_set_irq (icp->ss[i].output,0 );
Signature · 1 line
1.7.10.4
PATCH 2/13 pseries: Use #define for XICS base irq number
In reply to David GibsonFrom: Ben Herrenschmidt <[email protected]>
Currently the lowest "real" irq number for the XICS irq controller (as opposed to numbers reserved for IPIs and other special purposes) is hard coded as 16 in two places - in xics_system_init() and in spapr.c.
As well as being generally bad practice, we're going to need to change this number soon to fit in with the in-kernel XICS implementation. This patch adds a #define for this number to avoid future breakage.
--- hw/spapr.c | 2 +- hw/xics.c | 2 +- hw/xics.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)
hw/spapr.c +1 -1
@@ -801,7 +801,7 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args)/* Set up Interrupt Controller */ spapr->icp =xics_system_init (XICS_IRQS ); - spapr->next_irq =16 ; + spapr->next_irq =XICS_IRQ_BASE ;/* Set up EPOW events infrastructure */ spapr_events_init (spapr);
hw/xics.c +1 -1
@@ -549,7 +549,7 @@ struct icp_state *xics_system_init(int nr_irqs) ics =g_malloc0 (sizeof (*ics)); ics->nr_irqs = nr_irqs; - ics->offset =16 ; + ics->offset =XICS_IRQ_BASE ; ics->irqs =g_malloc0 (nr_irqs *sizeof (struct ics_irq_state )); icp->ics = ics;
hw/xics.h +1 -0
@@ -28,6 +28,7 @@#define __XICS_H__#define XICS_IPI 0x2 +#define XICS_IRQ_BASE 0x10struct icp_state ;
Signature · 1 line
1.7.10.4
PATCH 3/13 pseries: Return the token when we register an RTAS call
In reply to David GibsonFrom: Michael Ellerman <[email protected]>
The kernel will soon be able to service some RTAS calls. However the choice of tokens will still be up to userspace. To support this have spapr_rtas_register() return the token that is allocated for an RTAS call, that allows the calling code to tell the kernel what the token value is.
--- hw/spapr.h | 2 +- hw/spapr_rtas.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
hw/spapr.h +1 -1
@@ -320,7 +320,7 @@ static inline void rtas_st(target_ulong phys, int n, uint32_t val)typedef void (*spapr_rtas_fn )(sPAPREnvironment *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets); -void spapr_rtas_register (const char *name,spapr_rtas_fn fn); +int spapr_rtas_register (const char *name,spapr_rtas_fn fn);target_ulong spapr_rtas_call (sPAPREnvironment *spapr,uint32_t token,uint32_t nargs,target_ulong args,uint32_t nret,target_ulong rets);
hw/spapr_rtas.c +2 -2
@@ -242,7 +242,7 @@ target_ulong spapr_rtas_call(sPAPREnvironment *spapr,return H_PARAMETER ; } -void spapr_rtas_register (const char *name,spapr_rtas_fn fn) +int spapr_rtas_register (const char *name,spapr_rtas_fn fn) {int i;
@@ -258,7 +258,7 @@ void spapr_rtas_register(const char *name, spapr_rtas_fn fn) rtas_next->name = name; rtas_next->fn = fn; - rtas_next++; +return (rtas_next++ - rtas_table) +TOKEN_BASE ; } int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,
Signature · 1 line
1.7.10.4
PATCH 4/13 pseries: Allow RTAS tokens without a qemu handler
In reply to David GibsonFrom: Ben Herrenschmidt <[email protected]>
Kernel-based RTAS calls will not have a qemu handler, but will still be registered in qemu in order to be assigned a token number and appear in the device-tree.
Let's test for the name being NULL rather than the handler when deciding to skip an entry while building the device-tree
--- hw/spapr_rtas.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_rtas.c +1 -1
@@ -301,7 +301,7 @@ int spapr_rtas_device_tree_setup(void *fdt, hwaddr rtas_addr,for (i =0 ; i <TOKEN_MAX ; i++) {struct rtas_call *call = &rtas_table[i]; -if (!call->fn) { +if (!call->name) {continue ; }
Signature · 1 line
1.7.10.4
PATCH 5/13 pseries: Add tracepoints to the XICS interrupt controller
In reply to David GibsonThis patch adds tracing / debugging calls to the XICS interrupt controller implementation used on the pseries machine.
--- hw/xics.c | 23 ++++++++++++++++++++--- trace-events | 13 +++++++++++++ 2 files changed, 33 insertions(+), 3 deletions(-)
hw/xics.c +20 -3
@@ -26,6 +26,7 @@*/ #include "hw.h" +#include "trace.h" #include "hw/spapr.h" #include "hw/xics.h"
@@ -66,6 +67,8 @@ static void icp_check_ipi(struct icp_state *icp, int server)return ; } +trace_xics_icp_check_ipi (server, ss->mfrr); +if (XISR (ss)) {ics_reject (icp->ics,XISR (ss)); }
@@ -120,11 +123,13 @@ static void icp_set_mfrr(struct icp_state *icp, int server, uint8_t mfrr)static uint32_t icp_accept (struct icp_server_state *ss) { -uint32_t xirr; +uint32_t xirr = ss->xirr;qemu_irq_lower (ss->output); - xirr = ss->xirr; ss->xirr = ss->pending_priority <<24 ; + +trace_xics_icp_accept (xirr, ss->xirr); +return xirr; }
@@ -134,6 +139,7 @@ static void icp_eoi(struct icp_state *icp, int server, uint32_t xirr)/* Send EOI -> ICS */ ss->xirr = (ss->xirr & ~CPPR_MASK ) | (xirr &CPPR_MASK ); +trace_xics_icp_eoi (server, xirr, ss->xirr);ics_eoi (icp->ics, xirr &XISR_MASK );if (!XISR (ss)) {icp_resend (icp, server);
@@ -144,6 +150,8 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority) {struct icp_server_state *ss = icp->ss + server; +trace_xics_icp_irq (server, nr, priority); +if ((priority >=CPPR (ss)) || (XISR (ss) && (ss->pending_priority <= priority))) {ics_reject (icp->ics, nr);
@@ -153,6 +161,7 @@ static void icp_irq(struct icp_state *icp, int server, int nr, uint8_t priority) } ss->xirr = (ss->xirr & ~XISR_MASK ) | (nr &XISR_MASK ); ss->pending_priority = priority; +trace_xics_icp_raise (ss->xirr, ss->pending_priority);qemu_irq_raise (ss->output); } }
@@ -217,10 +226,12 @@ static void set_irq_msi(struct ics_state *ics, int srcno, int val) {struct ics_irq_state *irq = ics->irqs + srcno; +trace_xics_set_irq_msi (srcno, srcno + ics->offset); +if (val) {if (irq->priority ==0xff ) { irq->status |=XICS_STATUS_MASKED_PENDING ; -/* masked pending */ ; +trace_xics_masked_pending (); }else {icp_irq (ics->icp, irq->server, srcno + ics->offset, irq->priority); }
@@ -231,6 +242,7 @@ static void set_irq_lsi(struct ics_state *ics, int srcno, int val) {struct ics_irq_state *irq = ics->irqs + srcno; +trace_xics_set_irq_lsi (srcno, srcno + ics->offset);if (val) { irq->status |=XICS_STATUS_ASSERTED ; }else {
@@ -279,6 +291,8 @@ static void ics_write_xive(struct ics_state *ics, int nr, int server, irq->priority = priority; irq->saved_priority = saved_priority; +trace_xics_ics_write_xive (nr, srcno, server, priority); +if (irq->lsi) {write_xive_lsi (ics, srcno); }else {
@@ -290,6 +304,7 @@ static void ics_reject(struct ics_state *ics, int nr) {struct ics_irq_state *irq = ics->irqs + nr - ics->offset; +trace_xics_ics_reject (nr, nr - ics->offset); irq->status |=XICS_STATUS_REJECTED ;/* Irrelevant but harmless for LSI */ irq->status &= ~XICS_STATUS_SENT ;/* Irrelevant but harmless for MSI */ }
@@ -315,6 +330,8 @@ static void ics_eoi(struct ics_state *ics, int nr)int srcno = nr - ics->offset;struct ics_irq_state *irq = ics->irqs + srcno; +trace_xics_ics_eoi (nr); +if (irq->lsi) { irq->status &= ~XICS_STATUS_SENT ; }
trace-events +13 -0
@@ -1022,3 +1022,16 @@ spapr_pci_rtas_ibm_change_msi(unsigned func, unsigned req) "func %u, requested % spapr_pci_rtas_ibm_query_interrupt_source_number(unsigned ioa, unsigned intr) "queries for #%u, IRQ%u" spapr_pci_msi_write(uint64_t addr, uint64_t data, uint32_t dt_irq) "@%"PRIx64"<=%"PRIx64" IRQ %u" spapr_pci_lsi_set(const char *busname, int pin, uint32_t irq) "%s PIN%d IRQ %u" + +# hw/xics.c +xics_icp_check_ipi(int server, uint8_t mfrr) "CPU %d can take IPI mfrr=%#x" +xics_icp_accept(uint32_t old_xirr, uint32_t new_xirr) "icp_accept: XIRR %#"PRIx32"->%#"PRIx32 +xics_icp_eoi(int server, uint32_t xirr, uint32_t new_xirr) "icp_eoi: server %d given XIRR %#"PRIx32" new XIRR %#"PRIx32 +xics_icp_irq(int server, int nr, uint8_t priority) "cpu %d trying to deliver irq %#"PRIx32" priority %#x" +xics_icp_raise(uint32_t xirr, uint8_t pending_priority) "raising IRQ new XIRR=%#x new pending priority=%#x" +xics_set_irq_msi(int srcno, int nr) "set_irq_msi: srcno %d [irq %#x]" +xics_masked_pending(void) "set_irq_msi: masked pending" +xics_set_irq_lsi(int srcno, int nr) "set_irq_lsi: srcno %d [irq %#x]" +xics_ics_write_xive(int nr, int srcno, int server, uint8_t priority) "ics_write_xive: irq %#x [src %d] server %#x prio %#x" +xics_ics_reject(int nr, int srcno) "reject irq %#x [src %d]" +xics_ics_eoi(int nr) "ics_eoi: irq %#x"
Signature · 1 line
1.7.10.4
PATCH 6/13 pseries: Split xics irq configuration from state information
In reply to David GibsonCurrently the XICS irq controller code has a per-irq state structure which amongst other things includes whether the interrupt is level or message triggered - this is configured by the platform code, and is not directly visible to the guest. This leads to a slightly awkward construct at reset time where we need to reset everything in the state structure _except_ the lsi/msi flag, which needs to retain the information given at platform init time.
More importantly this flag will make matching the qemu state to the KVM state for the upcoming in-kernel XICS implementation more awkward. This patch, therefore, removes this flag from the per-irq state structure, instead adding a parallel array giving the lsi/msi configuration per irq.
--- hw/xics.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
hw/xics.c +8 -12
@@ -179,13 +179,13 @@ struct ics_irq_state {#define XICS_STATUS_REJECTED 0x4#define XICS_STATUS_MASKED_PENDING 0x8uint8_t status; -bool lsi; };struct ics_state {int nr_irqs;int offset;qemu_irq *qirqs; +bool *islsi;struct ics_irq_state *irqs;struct icp_state *icp; };
@@ -254,9 +254,8 @@ static void set_irq_lsi(struct ics_state *ics, int srcno, int val)static void ics_set_irq (void *opaque,int srcno,int val) {struct ics_state *ics = (struct ics_state *)opaque; -struct ics_irq_state *irq = ics->irqs + srcno; -if (irq->lsi) { +if (ics->islsi[srcno]) {set_irq_lsi (ics, srcno, val); }else {set_irq_msi (ics, srcno, val);
@@ -293,7 +292,7 @@ static void ics_write_xive(struct ics_state *ics, int nr, int server,trace_xics_ics_write_xive (nr, srcno, server, priority); -if (irq->lsi) { +if (ics->islsi[srcno]) {write_xive_lsi (ics, srcno); }else {write_xive_msi (ics, srcno);
@@ -314,10 +313,8 @@ static void ics_resend(struct ics_state *ics)int i;for (i =0 ; i < ics->nr_irqs; i++) { -struct ics_irq_state *irq = ics->irqs + i; -/* FIXME: filter by server#? */ -if (irq->lsi) { +if (ics->islsi[i]) {resend_lsi (ics, i); }else {resend_msi (ics, i);
@@ -332,7 +329,7 @@ static void ics_eoi(struct ics_state *ics, int nr)trace_xics_ics_eoi (nr); -if (irq->lsi) { +if (ics->islsi[srcno]) { irq->status &= ~XICS_STATUS_SENT ; } }
@@ -354,7 +351,7 @@ void xics_set_irq_type(struct icp_state *icp, int irq, bool lsi) {assert (ics_valid_irq (icp->ics, irq)); - icp->ics->irqs[irq - icp->ics->offset].lsi = lsi; + icp->ics->islsi[irq - icp->ics->offset] = lsi; } static target_ulong h_cppr(PowerPCCPU *cpu, sPAPREnvironment *spapr,
@@ -518,10 +515,8 @@ static void xics_reset(void *opaque)qemu_set_irq (icp->ss[i].output,0 ); } +memset (ics->irqs,0 ,sizeof (struct ics_irq_state ) * ics->nr_irqs);for (i =0 ; i < ics->nr_irqs; i++) { -/* Reset everything *except* the type */ - ics->irqs[i].server =0 ; - ics->irqs[i].status =0 ; ics->irqs[i].priority =0xff ; ics->irqs[i].saved_priority =0xff ; }
@@ -568,6 +563,7 @@ struct icp_state *xics_system_init(int nr_irqs) ics->nr_irqs = nr_irqs; ics->offset =XICS_IRQ_BASE ; ics->irqs =g_malloc0 (nr_irqs *sizeof (struct ics_irq_state )); + ics->islsi =g_malloc0 (nr_irqs *sizeof (bool )); icp->ics = ics; ics->icp = icp;
Signature · 1 line
1.7.10.4
PATCH 7/13 pseries: Implement PAPR NVRAM
In reply to David GibsonThe PAPR specification requires a certain amount of NVRAM, accessed via RTAS, which we don't currently implement in qemu. This patch addresses this deficiency, implementing the NVRAM as a VIO device, with some glue to instantiate it automatically based on a machine option.
The machine option specifies a drive id, which is used to back the NVRAM, making it persistent. If nothing is specified, the driver instead simply allocates space for the NVRAM, which will not be persistent
--- hw/ppc/Makefile.objs | 2 +- hw/spapr.c | 33 +++++++++ hw/spapr.h | 2 + hw/spapr_nvram.c | 196 ++++++++++++++++++++++++++++++++++++++++++++++++++ qemu-config.c | 4 ++ 5 files changed, 236 insertions(+), 1 deletion(-) create mode 100644 hw/spapr_nvram.c
hw/ppc/Makefile.objs +1 -1
@@ -11,7 +11,7 @@ obj-y += ppc_newworld.o obj-$(CONFIG_PSERIES) += spapr.o spapr_hcall.o spapr_rtas.o spapr_vio.o obj-$(CONFIG_PSERIES) += xics.o spapr_vty.o spapr_llan.o spapr_vscsi.o obj-$(CONFIG_PSERIES) += spapr_pci.o pci-hotplug.o spapr_iommu.o -obj-$(CONFIG_PSERIES) += spapr_events.o +obj-$(CONFIG_PSERIES) += spapr_events.o spapr_nvram.o # PowerPC 4xx boards obj-y += ppc4xx_devs.o ppc4xx_pci.o ppc405_uc.o ppc405_boards.o obj-y += ppc440_bamboo.o
hw/spapr.c +33 -0
@@ -657,6 +657,36 @@ static void spapr_cpu_reset(void *opaque) (spapr->htab_shift -18 ); } +static void spapr_create_nvram (sPAPREnvironment *spapr) +{ +QemuOpts *machine_opts; +DeviceState *dev; + + dev =qdev_create (&spapr->vio_bus->bus,"spapr-nvram" ); + + machine_opts =qemu_opts_find (qemu_find_opts ("machine" ),0 ); +if (machine_opts) { +const char *drivename; + + drivename =qemu_opt_get (machine_opts,"nvram" ); +if (drivename) { +BlockDriverState *bs; + + bs =bdrv_find (drivename); +if (!bs) { +fprintf (stderr,"No such block device \"%s\" for nvram\n" , + drivename); +exit (1 ); + } +qdev_prop_set_drive_nofail (dev,"drive" , bs); + } + } + +qdev_init_nofail (dev); + + spapr->nvram = (struct sPAPRNVRAM *)dev; +} +/* Returns whether we want to use VGA or not */ static int spapr_vga_init (PCIBus *pci_bus) {
@@ -818,6 +848,9 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) } } +/* We always have at least the nvram device on VIO */ +spapr_create_nvram (spapr); +/* Set up PCI */ spapr_pci_rtas_init ();
hw/spapr.h +2 -0
@@ -6,11 +6,13 @@struct VIOsPAPRBus ;struct sPAPRPHBState ; +struct sPAPRNVRAM ;struct icp_state ; typedef struct sPAPREnvironment { struct VIOsPAPRBus *vio_bus; QLIST_HEAD(, sPAPRPHBState) phbs; + struct sPAPRNVRAM *nvram; struct icp_state *icp; hwaddr ram_limit;
hw/spapr_nvram.c new file +196 -0
196 lines not on this page · raw message
qemu-config.c +4 -0
@@ -627,6 +627,10 @@ static QemuOptsList qemu_machine_opts = { .name = "usb", .type = QEMU_OPT_BOOL, .help = "Set on/off to enable/disable usb", + }, { + .name = "nvram", + .type = QEMU_OPT_STRING, + .help = "Drive backing persistent NVRAM", }, {/* End of list */ } },
Signature · 1 line
1.7.10.4
PATCH 8/13 pseries: Update SLOF for NVRAM support
In reply to David GibsonNow that we have implemented PAPR compatible NVRAM interfaces in qemu, this updates the SLOF firmware to actually initialize and use the NVRAM as a PAPR guest firmware is expected to do.
This SLOF update also includes an ugly but useful workaround for a bug in the SLES11 installer which caused it to fail under KVM.
--- pc-bios/README | 2 +- pc-bios/slof.bin | Bin 878640 -> 880832 bytes roms/SLOF | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-)
pc-bios/README +1 -1
@@ -17,7 +17,7 @@ - SLOF (Slimline Open Firmware) is a free IEEE 1275 Open Firmware implementation for certain IBM POWER hardware. The sources are at https://github.com/dgibson/SLOF, and the image currently in qemu is - built from git tag qemu-slof-20120731. + built from git tag qemu-slof-20121018. - sgabios (the Serial Graphics Adapter option ROM) provides a means for legacy x86 software to communicate with an attached serial console as
pc-bios/slof.bin binary +0 -0
roms/SLOF +1 -1
@@ -1 +1 @@ -Subproject commit f21f7a3f46b557eb5923f899ce8b4401b3cc6d91 +Subproject commit 0ad10f26c94a86a0c9c3970e53f9a9f6a744055d
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 8 lines · David Gibson
Now that we have implemented PAPR compatible NVRAM interfaces in qemu, this updates the SLOF firmware to actually initialize and use the NVRAM as a PAPR guest firmware is expected to do.
This SLOF update also includes an ugly but useful workaround for a bug in the SLES11 installer which caused it to fail under KVM.
I had a problem when installing SLES, when the installer et at 23%, a get:
Installation of package ./suse/ppc64/vim-base-7.2-8.15.2.ppc64.rpm failed. Subprocess failed. Error: RPM failed: error:
%post(vim-base-7.2-8.15.2.ppc64.rpm)
Is this the same problem?
Quoted 1 line
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 11 lines · Erlon Cruz
Quoted 8 lines · David Gibson
Now that we have implemented PAPR compatible NVRAM interfaces in qemu, this updates the SLOF firmware to actually initialize and use the NVRAM as a PAPR guest firmware is expected to do.
This SLOF update also includes an ugly but useful workaround for a bug in the SLES11 installer which caused it to fail under KVM.
Quoted 7 lines
I had a problem when installing SLES, when the installer et at 23%, a get:
Installation of package ./suse/ppc64/vim-base-7.2-8.15.2.ppc64.rpm failed. Subprocess failed. Error: RPM failed: error:
%post(vim-base-7.2-8.15.2.ppc64.rpm)Is this the same problem?
No, I don't think so. The NVRAM failure, I believe happens at the end when it's doing the yaboot setup. Although, I haven't met it myself, so I'm not certain.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Em 04/12/2012 20:58, "David Gibson" <[email protected]> escreveu:
Quoted 6 lines · Erlon Cruz
Quoted 4 lines
Quoted 1 line · David Gibson
Now that we have implemented PAPR compatible NVRAM interfaces in
qemu, this
Quoted 1 line
Quoted 1 line
Quoted 1 line
updates the SLOF firmware to actually initialize and use the NVRAM as
a
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
PAPR guest firmware is expected to do.
This SLOF update also includes an ugly but useful workaround for a
bug in
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
the SLES11 installer which caused it to fail under KVM.
I had a problem when installing SLES, when the installer et at 23%, a
get:
Quoted 2 lines
Quoted 2 lines
Installation of package ./suse/ppc64/vim-base-7.2-8.15.2.ppc64.rpm
failed.
Quoted 8 lines
Quoted 4 lines
Subprocess failed. Error: RPM failed: error:
%post(vim-base-7.2-8.15.2.ppc64.rpm)Is this the same problem?
No, I don't think so. The NVRAM failure, I believe happens at the end when it's doing the yaboot setup. Although, I haven't met it myself, so I'm not certain.
Have you succeed installing any SLES on QEMU pSeries? This is the first system I'm trying to install in an lpar. The guests I have I've installed in a power machine and then use the roots.
Quoted 3 lines
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_
_other_
Quoted 2 lines
| _way_ _around_!
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 27 lines · Erlon Cruz
Em 04/12/2012 20:58, "David Gibson" <[email protected]> escreveu:
Quoted 6 lines · Erlon Cruz
Quoted 4 lines
Quoted 1 line · David Gibson
Now that we have implemented PAPR compatible NVRAM interfaces in
qemu, this
Quoted 1 line
Quoted 1 line
Quoted 1 line
updates the SLOF firmware to actually initialize and use the NVRAM as
a
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
PAPR guest firmware is expected to do.
This SLOF update also includes an ugly but useful workaround for a
bug in
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
the SLES11 installer which caused it to fail under KVM.
I had a problem when installing SLES, when the installer et at 23%, a
get:
Quoted 2 lines
Quoted 2 lines
Installation of package ./suse/ppc64/vim-base-7.2-8.15.2.ppc64.rpm
failed.
Quoted 5 lines
Quoted 4 lines
Subprocess failed. Error: RPM failed: error:
%post(vim-base-7.2-8.15.2.ppc64.rpm)Is this the same problem?
Quoted 7 lines
Quoted 3 lines
No, I don't think so. The NVRAM failure, I believe happens at the end when it's doing the yaboot setup. Although, I haven't met it myself, so I'm not certain.
Have you succeed installing any SLES on QEMU pSeries? This is the first system I'm trying to install in an lpar. The guests I have I've installed in a power machine and then use the roots.
I haven't personally tried installing SLES, only Fedora and Debian (and not very recently for those). Some others in IBM have tried installing SLES - it used to fail because of this bug and another, I'm not sure if they've had a chance to try again since this fix.
Failing suddenly in the post script for vim-base seems a really unlikely problem to be caused by qemu/host bugs, though anything's possible. First thing I'd try is to triple-check your install media.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support
In reply to Erlon CruzQuoted 7 lines · Erlon Cruz
On Tue, Dec 4, 2012 at 12:42 AM, David Gibson <[email protected]> wrote:
Now that we have implemented PAPR compatible NVRAM interfaces in qemu, this updates the SLOF firmware to actually initialize and use the NVRAM as a PAPR guest firmware is expected to do.
Quoted 8 lines
This SLOF update also includes an ugly but useful workaround for a bug in the SLES11 installer which caused it to fail under KVM.
I had a problem when installing SLES, when the installer et at 23%, a get:
Installation of package ./suse/ppc64/vim-base-7.2-8.15.2.ppc64.rpm failed. Subprocess failed. Error: RPM failed: error: %post(vim-base-7.2-8.15.2.ppc64.rpm)
Could you please post
* the exact command line you were using
* details about your host: architecture, OS, kernel version
* is this using KVM or TCG?
* what SLES exactly are you using here?
* the exact QEMU version
Alex
Re: [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Hi Alex,
Quoted 4 lines
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
* details about your host: architecture, OS, kernel version
Quoted 1 line
Intel(R) Core(TM) i5-2520M CPU @ 2.50GH
Linux tpad 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012x86_64 x86_64 x86_64 GNU/Linux
* is this using KVM or TCG?
Quoted 1 line
TCG
Quoted 2 lines
* what SLES exactly are you using here?
SLES-11-SP2-DVD-ppc64-GM-DVD1.iso: sha256 -> 2247dd6bb495eb50860668e46f7d6ba004eece9909f347c8ce487fd6a5f65ee1
* the exact QEMU version
Quoted 2 lines
Git: 01bbd8b... Update version for 1.3.0-rc2
I also run the media check from the installer and it says its OK. The only abnormal think i could see is a message about the network interface, but it doesn't seen to affect the behavior in the rootfs guests:
Starting udev... ibmveth 1001: (unregistered net_device): unable to change
checksum offload settings. 1 rc=-2 ret_attr=1001
This last time I run, before that first error I mentioned I got this error in this package:
Installation of package ./suse/ppc64/liborc-0_4-0-0.4.11-7.5.23.ppc64.rpm failed.
Subprocess failed. Error: RPM failed: Inconsistency detected by ld.so:
dl-lookup
but after retrying it passed. But when it hit the vi-base it stuck in that error no matter how many times I retry or skip the package.
Erlon
Re: [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 7 lines · Erlon Cruz
Hi Alex,
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512 -net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
Ah, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
Quoted 21 lines
* details about your host: architecture, OS, kernel version
Intel(R) Core(TM) i5-2520M CPU @ 2.50GH
Linux tpad 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012x86_64x86_64x86_64GNU/Linux* is this using KVM or TCG?
TCG
* what SLES exactly are you using here?
SLES-11-SP2-DVD-ppc64-GM-DVD1.iso: sha256 ->
2247dd6bb495eb50860668e46f7d6ba004eece9909f347c8ce487fd6a5f65ee1* the exact QEMU version
Git: 01bbd8b... Update version for 1.3.0-rc2
I also run the media check from the installer and it says its OK. The only abnormal think i could see is a message about the network interface, but it doesn't seen to affect the behavior in the rootfs guests:
Quoted 8 lines
Starting udev... ibmveth 1001: (unregistered
net_device): unable to change checksum offload settings. 1 rc=-2 ret_attr=1001This last time I run, before that first error I mentioned I got this error in this package:
Installation of package ./suse/ppc64/liborc-0_4-0-0.4.11-7.5.23.ppc64.rpm failed. Subprocess failed. Error: RPM failed: Inconsistency detected by ld.so: dl-lookup
but after retrying it passed. But when it hit the vi-base it stuck in that error no matter how many times I retry or skip the package.
This smells quite a lot like a TCG emulation bug. Could you please check if older versions used to work, so whether this is a regression or something that never really worked?
Please also give -M pseries -vga std a try.
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 5 lines · Alexander Graf
Quoted 2 lines · Erlon Cruz
Hi Alex,
Quoted 7 lines
Quoted 5 lines
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512 -net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
Ah, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
Scratch that. -machine type=pseries obviously makes this a pseries machine.
Please still try to check if 1.2 or 1.1 work for you. Checking if disabling graphics makes things work would be interesting too.
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 12 lines · Alexander Graf
Quoted 9 lines · Alexander Graf
Quoted 6 lines · Erlon Cruz
Hi Alex,
Could you please post
* the exact command line you were using
Quoted 7 lines
Quoted 3 lines
Quoted 1 line
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512 -net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
Ah, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
Scratch that. -machine type=pseries obviously makes this a pseries machine.
Please still try to check if 1.2 or 1.1 work for you. Checking if disabling graphics makes things work would be interesting too.
Also -cpu 970 would be an interesting thing to try.
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 27 lines · Alexander Graf
On 05.12.2012, at 15:37, Alexander Graf wrote:
On 05.12.2012, at 15:35, Alexander Graf wrote:
On 05.12.2012, at 15:09, Erlon Cruz wrote:
Hi Alex,
Quoted 4 lines
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,serverAh, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
Quoted 8 lines
Scratch that. -machine type=pseries obviously makes this a pseries machine.
Please still try to check if 1.2 or 1.1 work for you. Checking if disabling graphics makes things work would be interesting too.
Also -cpu 970 would be an interesting thing to try.
This fails right in the kernel start:
found display : /pci@800000020000001/vga@0, opening... done
instantiating rtas at 0x000000001dbf0000... done boot cpu hw idx 0
copying OF device tree...
Building dt strings...
Building dt structure...
Device tree strings 0x0000000005780000 -> 0x0000000005780780 Device tree struct 0x0000000005790000 -> 0x00000000057a0000 Calling quiesce...
returning from prom_init
Trying to read invalid spr 8 008 at c000000000926cbc Trying to read invalid spr 28 01c at 0000000000000720
Quoted 3 lines
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
In reply to Alexander GrafQuoted 20 lines · Alexander Graf
On 05.12.2012, at 15:35, Alexander Graf wrote:
On 05.12.2012, at 15:09, Erlon Cruz wrote:
Hi Alex,
Quoted 4 lines
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
Quoted 10 lines
Ah, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
Scratch that. -machine type=pseries obviously makes this a pseries machine.
Please still try to check if 1.2 or 1.1 work for you. Checking if disabling graphics makes things work would be interesting too.
All versions (v1.0, v1.1.0, v1.2.0) shows the same problem. Any idea on how to get more info about this? Is there a way to reproduce the error from the shell I got after aborting?
Quoted 3 lines
Alex
Re: [Qemu-devel] [PATCH 08/13] pseries: Update SLOF for NVRAM support
In reply to Alexander GrafQuoted 64 lines · Alexander Graf
On 05.12.2012, at 15:09, Erlon Cruz wrote:
Hi Alex,
Quoted 4 lines
Could you please post
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,serverAh, so you're using -M mac99, which means any patch that says "pseries" shouldn't affect that VM at all.
* details about your host: architecture, OS, kernel version
Quoted 1 line
Intel(R) Core(TM) i5-2520M CPU @ 2.50GH
Linux tpad 3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012x86_64x86_64x86_64GNU/Linux* is this using KVM or TCG?
Quoted 1 line
TCG
Quoted 2 lines
* what SLES exactly are you using here?
SLES-11-SP2-DVD-ppc64-GM-DVD1.iso: sha256 ->
2247dd6bb495eb50860668e46f7d6ba004eece9909f347c8ce487fd6a5f65ee1* the exact QEMU version
Quoted 2 lines
Git: 01bbd8b... Update version for 1.3.0-rc2
I also run the media check from the installer and it says its OK. The only abnormal think i could see is a message about the network interface, but it doesn't seen to affect the behavior in the rootfs guests:
Starting udev... ibmveth 1001: (unregistered
net_device): unable to
change checksum offload settings. 1 rc=-2 ret_attr=1001This last time I run, before that first error I mentioned I got this error in this package:
Installation of package ./suse/ppc64/liborc-0_4-0-0.4.11-7.5.23.ppc64.rpm failed.
Subprocess failed. Error: RPM failed: Inconsistency detected by ld.so:
dl-lookupbut after retrying it passed. But when it hit the vi-base it stuck in that error no matter how many times I retry or skip the package.
Quoted 6 lines
This smells quite a lot like a TCG emulation bug. Could you please check if older versions used to work, so whether this is a regression or something that never really worked?
Please also give -M pseries -vga std a try.
/home/erlon/internal_git/qemu/ppc64-softmmu/qemu-system-ppc64 -machine
type=pseries,usb=off -m 512 -net nic,vlan=0 -net tap -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -vga std
Bringing up interface tap1... Done
Adding interface tap1 to bridge br0... Done
Warning: Disabling some instructions which are not emulated by TCG (0x0, 0x6)
Then I got no output after: Trying to load from cdrom ... Successfully loaded
Not sure if it hanged or just the graphics where not shown. Does SLES uses console=hvc0 in the boot options?
Quoted 4 lines
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
In reply to Erlon CruzHi Erlon,
Quoted 5 lines · Erlon Cruz
Hi Alex,
Quoted 2 lines
Could you please post
Quoted 7 lines
Quoted 2 lines
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,server
I have had success with following command:
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512 -nographic -cdrom ../../distro/openSUSE-NET64-ppc64-Build0022-Media.iso -hda ../../imgs/guest_suse.disk
Using the following server repo:
http://download.opensuse.org/ports/ppc/distribution/12.2/repo/oss
I havent tried SLES tough.
Regards
Nikunj
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Hi Nikunj,
Its probabily might be a problem that happen only with SLES. I could install fedora 17 ppc. The instalation was OK, the only problem I had was in the boot, fedora needs the NVRAM capability.
David, Is this upstream already?
Erlon
On Fri, Dec 7, 2012 at 6:10 AM, Nikunj A Dadhania <[email protected]
Quoted 34 lines
wrote:
Hi Erlon,
Quoted 5 lines · Erlon Cruz
Hi Alex,
Quoted 2 lines
Could you please post
Quoted 7 lines
Quoted 2 lines
* the exact command line you were using
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
-net nic,vlan=0 -net tap -nographic -cdrom /exports/isos/SLES-11-SP2-DVD-ppc64-GM-DVD1.iso -hda /exports/sles11_sp2.qcow2 -monitor unix:/dev/tty1,nowait,serverI have had success with following command:
./ppc64-softmmu/qemu-system-ppc64 -machine type=pseries,usb=off -m 512
(quoted diff) +0
-2-nographic -cdrom ../../distro/openSUSE-NET64-ppc64-Build0022-Media.iso -hda ../../imgs/guest_suse.diskUsing the following server repo:
http://download.opensuse.org/ports/ppc/distribution/12.2/repo/ossI havent tried SLES tough.
Regards
Nikunj
Re: [Qemu-devel] [Qemu-ppc] [PATCH 08/13] pseries: Update SLOF for NVRAM support
Quoted 4 lines · Erlon Cruz
Hi Nikunj,
Its probabily might be a problem that happen only with SLES. I could install fedora 17 ppc. The instalation was OK, the only problem I had was in the boot, fedora needs the NVRAM capability. David, Is this upstream already?
It's in my tree, so it will be in master probably by next week.
Alex
PATCH 9/13 pseries: Don't allow TCE (iommu) tables to be registered with duplicate LIOBNs
In reply to David GibsonThe PAPR specification requires that every bus or device mediated by the IOMMU have a unique Logical IO Bus Number (LIOBN). This patch adds a check to enforce this, which will help catch errors in configuration earlier.
--- hw/spapr_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+)
hw/spapr_iommu.c +6 -0
@@ -120,6 +120,12 @@ DMAContext *spapr_tce_new_dma_context(uint32_t liobn, size_t window_size) {sPAPRTCETable *tcet; +if (spapr_tce_find_by_liobn (liobn)) { +fprintf (stderr,"Attempted to create TCE table with duplicate" +" LIOBN 0x%x\n" , liobn); +return NULL ; + } +if (!window_size) {return NULL ; }
Signature · 1 line
1.7.10.4
PATCH 10/13 target-ppc: Don't use hwaddr to represent hardware state
In reply to David GibsonThe hwaddr type is somewhat vaguely defined as being able to contain bus addresses on the widest possible bus in the system. For that reason it's discouraged for representing specific pieces of persistent hardware state, which should instead use an explicit width type that matches the bits available in real hardware. In particular, because of the possibility that the size of hwaddr might change if different buses are added to the target in future, it's not suitable for use in vm state descriptions for savevm and migration.
This patch purges such unwise uses of hwaddr from the ppc target code, which turns out to be just one. The ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr for the real address field. This patch changes it to be a fixed uint64_t which is suitable enough for all machine types which use this structure.
Other uses of hwaddr in CPUPPCState turn out not to be problematic:htab_base and htab_mask are just used for the convenience of the TCG code; the underlying machine state is the SDR1 register, which is stored with a suitable type already. Likewise the mpic_cpu_base field is only used internally and does not represent fundamental hardware state which needs to be saved.
--- target-ppc/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
target-ppc/cpu.h +1 -1
@@ -355,7 +355,7 @@ struct ppc6xx_tlb_t {typedef struct ppcemb_tlb_t ppcemb_tlb_t ;struct ppcemb_tlb_t { -hwaddr RPN; +uint64_t RPN;target_ulong EPN;target_ulong PID;target_ulong size;
Signature · 1 line
1.7.10.4
Alexander Graf
AppliedRe: [Qemu-devel] [PATCH 10/13] target-ppc: Don't use hwaddr to represent hardware state
Quoted 15 lines · David Gibson
The hwaddr type is somewhat vaguely defined as being able to contain bus addresses on the widest possible bus in the system. For that reason it's discouraged for representing specific pieces of persistent hardware state, which should instead use an explicit width type that matches the bits available in real hardware. In particular, because of the possibility that the size of hwaddr might change if different buses are added to the target in future, it's not suitable for use in vm state descriptions for savevm and migration.
This patch purges such unwise uses of hwaddr from the ppc target code, which turns out to be just one. The
ppcemb_tlb_tstruct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr for the real address field. This patch changes it to be a fixeduint64_twhich is suitable enough for all machine types which use this structure.
Quoted 8 lines
Other uses of hwaddr in CPUPPCState turn out not to be problematic:
htab_baseandhtab_maskare just used for the convenience of the TCG code; the underlying machine state is the SDR1 register, which is stored with a suitable type already. Likewise thempic_cpu_basefield is only used internally and does not represent fundamental hardware state which needs to be saved.Signed-off-by David Gibson <[email protected]>
Thanks, applied to ppc-next.
Alex
PATCH 11/13 pseries: Fixes and enhancements to L1 cache properties
In reply to David GibsonPAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
--- hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)
hw/spapr.c +18 -2
@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size;
@@ -335,10 +339,22 @@ static void *spapr_create_fdt_skel(const char *cpu_model,_FDT ((fdt_property_string (fdt,"device_type" ,"cpu" )));_FDT ((fdt_property_cell (fdt,"cpu-version" , env->spr[SPR_PVR ]))); -_FDT ((fdt_property_cell (fdt,"dcache-block-size" , +_FDT ((fdt_property_cell (fdt,"d-cache-block-size" , env->dcache_line_size))); -_FDT ((fdt_property_cell (fdt,"icache-block-size" , +_FDT ((fdt_property_cell (fdt,"d-cache-line-size" , + env->dcache_line_size))); +_FDT ((fdt_property_cell (fdt,"i-cache-block-size" , + env->icache_line_size))); +_FDT ((fdt_property_cell (fdt,"i-cache-line-size" , env->icache_line_size))); + +if (dcache_size) { +_FDT ((fdt_property_cell (fdt,"d-cache-size" , dcache_size))); + } +if (icache_size) { +_FDT ((fdt_property_cell (fdt,"i-cache-size" , icache_size))); + } +_FDT ((fdt_property_cell (fdt,"timebase-frequency" , tbfreq)));_FDT ((fdt_property_cell (fdt,"clock-frequency" , cpufreq)));_FDT ((fdt_property_cell (fdt,"ibm,slb-size" , env->slb_nr)));
target-ppc/cpu.h +1 -0
@@ -1031,6 +1031,7 @@ struct CPUPPCState {int dcache_line_size;int icache_line_size; +int l1_dcache_size, l1_icache_size;/* Those resources are used during exception processing */ /* CPU model definition */
target-ppc/kvm.c +10 -0
@@ -967,6 +967,16 @@ uint32_t kvmppc_get_dfp(void)return kvmppc_read_int_cpu_dt ("ibm,dfp" ); } +int kvmppc_get_icache_size (void ) +{ +return kvmppc_read_int_cpu_dt ("i-cache-size" ); +} + +int kvmppc_get_dcache_size (void ) +{ +return kvmppc_read_int_cpu_dt ("d-cache-size" ); +} +int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len) {uint32_t *hc = (uint32_t *)buf;
target-ppc/kvm_ppc.h +12 -0
@@ -19,6 +19,8 @@ uint32_t kvmppc_get_tbfreq(void);uint64_t kvmppc_get_clockfreq (void );uint32_t kvmppc_get_vmx (void );uint32_t kvmppc_get_dfp (void ); +int kvmppc_get_icache_size (void ); +int kvmppc_get_dcache_size (void );int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len);int kvmppc_set_interrupt (CPUPPCState *env,int irq,int level);void kvmppc_set_papr (CPUPPCState *env);
@@ -55,6 +57,16 @@ static inline uint32_t kvmppc_get_dfp(void)return 0 ; } +static inline int kvmppc_get_icache_size (void ) +{ +return 0 ; +} + +static inline int kvmppc_get_dcache_size (void ) +{ +return 0 ; +} +static inline int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len) {return -1 ;
target-ppc/translate_init.c +4 -0
@@ -6753,6 +6753,10 @@ static void init_proc_POWER7 (CPUPPCState *env)init_excp_POWER7 (env); env->dcache_line_size =128 ; env->icache_line_size =128 ; + + env->l1_dcache_size =0x8000 ; + env->l1_icache_size =0x8000 ; +/* Allocate hardware IRQ controller */ ppcPOWER7_irq_init (env);/* Can't find information on what this should be on reset. This
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 27 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)hw/spapr.c +0
-0
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 7 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;
By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
If it would still work just fine, I'd say ditch the "ask the host" bit and always use the sizes from the cpu definition.
Alex
Quoted 109 lines
hw/spapr.c +14
-2uint32_t page_sizes_prop[64 ];size_t page_sizes_prop_size;@@ -335,10 +339,22 @@ static void *spapr_create_fdt_skel(const char *cpu_model,_FDT ((fdt_property_string (fdt,"device_type" ,"cpu" )));_FDT ((fdt_property_cell (fdt,"cpu-version" , env->spr[SPR_PVR ]))); -_FDT ((fdt_property_cell (fdt,"dcache-block-size" , +_FDT ((fdt_property_cell (fdt,"d-cache-block-size" , env->dcache_line_size))); -_FDT ((fdt_property_cell (fdt,"icache-block-size" , +_FDT ((fdt_property_cell (fdt,"d-cache-line-size" , + env->dcache_line_size))); +_FDT ((fdt_property_cell (fdt,"i-cache-block-size" , + env->icache_line_size))); +_FDT ((fdt_property_cell (fdt,"i-cache-line-size" , env->icache_line_size))); + +if (dcache_size) { +_FDT ((fdt_property_cell (fdt,"d-cache-size" , dcache_size))); + } +if (icache_size) { +_FDT ((fdt_property_cell (fdt,"i-cache-size" , icache_size))); + } +_FDT ((fdt_property_cell (fdt,"timebase-frequency" , tbfreq)));_FDT ((fdt_property_cell (fdt,"clock-frequency" , cpufreq)));_FDT ((fdt_property_cell (fdt,"ibm,slb-size" , env->slb_nr)));target-ppc/cpu.h +1
-0@@ -1031,6 +1031,7 @@ struct CPUPPCState {int dcache_line_size;int icache_line_size; +int l1_dcache_size, l1_icache_size;/* Those resources are used during exception processing */ /* CPU model definition */ target-ppc/kvm.c +10
-0@@ -967,6 +967,16 @@ uint32_t kvmppc_get_dfp(void)return kvmppc_read_int_cpu_dt ("ibm,dfp" ); } +int kvmppc_get_icache_size (void ) +{ +return kvmppc_read_int_cpu_dt ("i-cache-size" ); +} + +int kvmppc_get_dcache_size (void ) +{ +return kvmppc_read_int_cpu_dt ("d-cache-size" ); +} +int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len) {uint32_t *hc = (uint32_t *)buf;target-ppc/kvm_ppc.h +12
-0@@ -19,6 +19,8 @@ uint32_t kvmppc_get_tbfreq(void);uint64_t kvmppc_get_clockfreq (void );uint32_t kvmppc_get_vmx (void );uint32_t kvmppc_get_dfp (void ); +int kvmppc_get_icache_size (void ); +int kvmppc_get_dcache_size (void );int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len);int kvmppc_set_interrupt (CPUPPCState *env,int irq,int level);void kvmppc_set_papr (CPUPPCState *env);@@ -55,6 +57,16 @@ static inline uint32_t kvmppc_get_dfp(void)return 0 ; } +static inline int kvmppc_get_icache_size (void ) +{ +return 0 ; +} + +static inline int kvmppc_get_dcache_size (void ) +{ +return 0 ; +} +static inline int kvmppc_get_hypercall (CPUPPCState *env,uint8_t *buf,int buf_len) {return -1 ;target-ppc/translate_init.c +4
-0@@ -6753,6 +6753,10 @@ static void init_proc_POWER7 (CPUPPCState *env)init_excp_POWER7 (env); env->dcache_line_size =128 ; env->icache_line_size =128 ; + + env->l1_dcache_size =0x8000 ; + env->l1_icache_size =0x8000 ; +/* Allocate hardware IRQ controller */ ppcPOWER7_irq_init (env);/* Can't find information on what this should be on reset. This Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)
Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode is one example, but I'm not sure there aren't others. e.g. the hypervisor limiting the amount of cache available to a partition, or portions of the cache disabled due to a chicken switch or the like. In short, when we have the cache size information directly available from the host, I'd really prefer to use that, over getting the host PVR and assuming what we have in our table is correct.
Quoted 2 lines
If it would still work just fine, I'd say ditch the "ask the host" bit and always use the sizes from the cpu definition.
So, if the cache size is wrong it will probably work for most purposes. In fact as far as I know, it will always work from a strict functionality point of view. But if something in the guest uses the cache size information to optimize its cache blocking (I'm thinking of BLAS) it could have a big effect on performance.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 48 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 8 lines
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Look at it from one step ahead. Take POWER8 and POWER7. I want to be able to live migrate from a POWER7 system to a POWER8 system. On my POWER8 box, the generated dt should look like it did on my POWER7 box.
Quoted 7 lines
is one example, but I'm not sure there aren't
others. e.g. the hypervisor limiting the amount of cache available to a partition, or portions of the cache disabled due to a chicken switch or the like. In short, when we have the cache size information directly available from the host, I'd really prefer to use that, over getting the host PVR and assuming what we have in our table is correct.
I disagree. We can add a sanity check that -cpu host has to find the same cache size as is in the cpu table. We could even make that sanity check take the host value if the cpu table value is 0 and issue a warning. But I don't want to have host information take precedence over user controlled settings unless we have to (tb freq).
Quoted 9 lines
Quoted 3 lines
If it would still work just fine, I'd say ditch the "ask the host" bit and always use the sizes from the cpu definition.
So, if the cache size is wrong it will probably work for most purposes. In fact as far as I know, it will always work from a strict functionality point of view. But if something in the guest uses the cache size information to optimize its cache blocking (I'm thinking of BLAS) it could have a big effect on performance.
Well, then today we are at the same level as x86. And with proper cpu table cache size info we are even better than x86. :)
Alex
Quoted 6 lines
Signature · 5 lines
-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the cpu_def.
Quoted 4 lines
Look at it from one step ahead. Take POWER8 and POWER7. I want to be able to live migrate from a POWER7 system to a POWER8 system. On my POWER8 box, the generated dt should look like it did on my POWER7 box.
So.. this is kind of an aside at this point but POWER6/POWER7/POWER8 compatibility is more complicated than that. For TCG or KVM-PR, -cpu POWER6 should be possible, and pretty much identical to a real POWER6. For KVM HV, the best we can do is POWER7's POWER6 compatibility mode, which is kinda-similar to POWER6, but still a fair way from identical (for starters the POWER7 PVR value is still visible). It should be close enough to run (PAPR compliant) OSes that know about POWER6 but not POWER7 - but only if they use the device tree the way they're supposed to (which includes amongst other things a special "virtual PVR" value for this quasi-POWER6). And as long as they don't use the performance counters.
As far as (HV) KVM is concerned our plan is to trigger the POWER6 compatibility mode by setting the relevant virtual PVR value in SET_SREGS. For qemu it's a bit less clear - we could add a cputable entry for the virtual PVR - -cpu POWER7_POWER6 or something. Or alternatively we could treat the compatibility mode as that - a special mode bit in the env. The latter has the advantage that we can use the PAPR defined CAS system to see what processors the guest OS advertises support for and automatically switch on the compat mode when necessary.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 66 lines · David Gibson
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Quoted 5 lines
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the
cpu_def.
Can we set a bit somewhere that allows us to do a sanity check later? After all, the values coming from the host and the values in the populated env really should just be identical for -cpu host. Every time they're not, it's simply a bug that needs to be reported.
Quoted 6 lines
Quoted 5 lines
Look at it from one step ahead. Take POWER8 and POWER7. I want to be able to live migrate from a POWER7 system to a POWER8 system. On my POWER8 box, the generated dt should look like it did on my POWER7 box.
Quoted 11 lines
So.. this is kind of an aside at this point but POWER6/POWER7/POWER8 compatibility is more complicated than that. For TCG or KVM-PR, -cpu POWER6 should be possible, and pretty much identical to a real POWER6. For KVM HV, the best we can do is POWER7's POWER6 compatibility mode, which is kinda-similar to POWER6, but still a fair way from identical (for starters the POWER7 PVR value is still visible). It should be close enough to run (PAPR compliant) OSes that know about POWER6 but not POWER7 - but only if they use the device tree the way they're supposed to (which includes amongst other things a special "virtual PVR" value for this quasi-POWER6). And as long as they don't use the performance counters.
Sounds pretty broken. But I'm sort of getting used to that with HV mode in POWER :).
So if we made things properly transparent and well working, could we use PR KVM as fallback for HV migration? That'd get rid of the whole category of problems, no?
But really, for now -cpu host on a POWER7 box == -cpu POWER7. So the cache sizes will automatically match.
Alex
Quoted 15 lines
As far as (HV) KVM is concerned our plan is to trigger the POWER6 compatibility mode by setting the relevant virtual PVR value in
SET_SREGS. For qemu it's a bit less clear - we could add a cputable entry for the virtual PVR - -cpuPOWER7_POWER6or something. Or alternatively we could treat the compatibility mode as that - a special mode bit in the env. The latter has the advantage that we can use the PAPR defined CAS system to see what processors the guest OS advertises support for and automatically switch on the compat mode when necessary.Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 75 lines · Alexander Graf
Quoted 66 lines · David Gibson
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Quoted 5 lines
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the
cpu_def.
Quoted 5 lines
Can we set a bit somewhere that allows us to do a sanity check later? After all, the values coming from the host and the values in the populated env really should just be identical for -cpu host. Every time they're not, it's simply a bug that needs to be reported.
That works. Although it's not obvious where to put the check and fixup. kvmppc_fixup_cpu() seems like the obvious place, but that's no good because it's called before the per-cpu-type init function, which is what populates the expected cachesize values.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 82 lines · David Gibson
Quoted 75 lines · Alexander Graf
Quoted 66 lines · David Gibson
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Quoted 5 lines
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the
cpu_def.Quoted 5 lines
Can we set a bit somewhere that allows us to do a sanity check later? After all, the values coming from the host and the values in the populated env really should just be identical for -cpu host. Every time they're not, it's simply a bug that needs to be reported.
Quoted 4 lines
That works. Although it's not obvious where to put the check and fixup.
kvmppc_fixup_cpu()seems like the obvious place, but that's no good because it's called before the per-cpu-type init function, which is what populates the expected cachesize values.
That's a real shame. Any reason we don't run it after the init function? Fixup indicates that it fixes things up after they happened, not before :).
Alex
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 85 lines · Alexander Graf
Quoted 82 lines · David Gibson
Quoted 80 lines · Alexander Graf
Quoted 66 lines · David Gibson
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Quoted 5 lines
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the
cpu_def.Can we set a bit somewhere that allows us to do a sanity check later? After all, the values coming from the host and the values in the populated env really should just be identical for -cpu host. Every time they're not, it's simply a bug that needs to be reported.
Quoted 8 lines
Quoted 4 lines
That works. Although it's not obvious where to put the check and fixup.
kvmppc_fixup_cpu()seems like the obvious place, but that's no good because it's called before the per-cpu-type init function, which is what populates the expected cachesize values.That's a real shame. Any reason we don't run it after the init function? Fixup indicates that it fixes things up after they happened, not before :).
Well, the very first thing that kvmppc_fixup_cpu() did, when I first implemented it is to adjust the cpu numbers so we get the right SMT behaviour under KVM. I was concerned that later parts of the initialization might use the cpu_index.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [Qemu-ppc] [PATCH 11/13] pseries: Fixes and enhancements to L1 cache properties
Quoted 91 lines · David Gibson
Quoted 90 lines · Alexander Graf
Quoted 86 lines · David Gibson
Quoted 75 lines · Alexander Graf
Quoted 66 lines · David Gibson
Quoted 57 lines · Alexander Graf
Quoted 53 lines · David Gibson
Quoted 25 lines · Alexander Graf
Quoted 22 lines · David Gibson
PAPR requires that the device tree's CPU nodes have several properties with information about the L1 cache. We created two of these properties, but with incorrect names - "[id]cache-block-size" instead of "[id]-cache-block-size" (note the extra hyphen).
We were also missing some of the required cache properties. This patch adds the [id]-cache-line-size properties (which have the same values as the block size properties in all current cases). We also add the [id]-cache-size properties. The latter requires some extra infrastructure in the general target-ppc code to (optionally) set the cache sizes for various CPUs. We obtain the published values either from there, or from the host when KVM is in use.
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 20 ++++++++++++++++++-- target-ppc/cpu.h | 1 + target-ppc/kvm.c | 10 ++++++++++ target-ppc/kvm_ppc.h | 12 ++++++++++++ target-ppc/translate_init.c | 4 ++++ 5 files changed, 45 insertions(+), 2 deletions(-)Quoted 15 lines
hw/spapr.c static void *spapr_create_fdt_skel(const char *cpu_model, · line 321
Quoted 12 lines
hw/spapr.c +4
-0@@ -315,6 +315,10 @@ static void *spapr_create_fdt_skel(const char *cpu_model, 0xffffffff, 0xffffffff};uint32_t tbfreq =kvm_enabled () ?kvmppc_get_tbfreq () :TIMEBASE_FREQ ;uint32_t cpufreq =kvm_enabled () ?kvmppc_get_clockfreq () :1000000000 ; +int dcache_size =kvm_enabled () ?kvmppc_get_dcache_size () + : env->l1_dcache_size; +int icache_size =kvm_enabled () ?kvmppc_get_icache_size () + : env->l1_icache_size;By default with KVM we use -cpu host, right? So we already should get the correct cache sizes for the CPU you're on.
Um.. sort of. The first problem with that is that I only just added the cache size information to qemu, so only a few CPUs currently populate that information. Using the host info means we can get the right information even for CPUs that don't yet have cache info in qemu.
Quoted 4 lines
Imagine we would support the compatibility feature where you could run with -cpu POWER6 on a POWER7 machine. Would exposing the POWER6 cache size rather than the host's make any real difference to the guest? Or would it work nevertheless?
Quoted 7 lines
Quoted 3 lines
The second problem is that there may be circumstances where the cache size is altered from the normal size for the cpu. Running in POWER6 compat mode
Well, either we want to be compatible or we don't :). If we run with -cpu POWER6 we want to generate the same dt as we did on a POWER6 system itself.
Quoted 5 lines
Hrm. Ok.
So, the remaining difficulty I have with that is that for -cpu HOST we should still take the cache sizes from the host, but that can't easily be done because they're only stored in the env, not the
cpu_def.Quoted 5 lines
Can we set a bit somewhere that allows us to do a sanity check later? After all, the values coming from the host and the values in the populated env really should just be identical for -cpu host. Every time they're not, it's simply a bug that needs to be reported.
That works. Although it's not obvious where to put the check and fixup.
kvmppc_fixup_cpu()seems like the obvious place, but that's no good because it's called before the per-cpu-type init function, which is what populates the expected cachesize values.
Quoted 8 lines
Quoted 3 lines
That's a real shame. Any reason we don't run it after the init function? Fixup indicates that it fixes things up after they happened, not before :).
Well, the very first thing that
kvmppc_fixup_cpu()did, when I first implemented it is to adjust the cpu numbers so we get the right SMT behaviour under KVM. I was concerned that later parts of the initialization might use thecpu_index.
Then create 2 fixups. One before and one after init ;).
Alex
Quoted 6 lines
Signature · 5 lines
-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
PATCH 12/13 pseries: Increase default NVRAM size
In reply to David GibsonIf no image file for NVRAM is specified, the pseries machine currently creates a 16K non-persistent NVRAM by default. This basically works, but is not large enough for current firmware and guest kernels to create all the NVRAM partitions they would like to. Increasing the default size to 64K addresses this and stops the guest generating error messages.
--- hw/spapr_nvram.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_nvram.c +1 -1
@@ -37,7 +37,7 @@ typedef struct sPAPRNVRAM { } sPAPRNVRAM;#define MIN_NVRAM_SIZE 8192 -#define DEFAULT_NVRAM_SIZE 16384 +#define DEFAULT_NVRAM_SIZE 65536#define MAX_NVRAM_SIZE (UINT16_MAX * 16) static void rtas_nvram_fetch(sPAPREnvironment *spapr,
Signature · 1 line
1.7.10.4
Alexander Graf
AppliedRe: [Qemu-devel] [PATCH 12/13] pseries: Increase default NVRAM size
Quoted 7 lines · David Gibson
If no image file for NVRAM is specified, the pseries machine currently creates a 16K non-persistent NVRAM by default. This basically works, but is not large enough for current firmware and guest kernels to create all the NVRAM partitions they would like to. Increasing the default size to 64K addresses this and stops the guest generating error messages.
Signed-off-by David Gibson <[email protected]>
Thanks, applied to ppc-next.
Alex
PATCH 13/13 target-ppc: Give a meaningful error if too many threads are specified
In reply to David GibsonFrom: Mike Qiu <[email protected]>
Currently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors.
This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support.
--- target-ppc/translate_init.c | 8 ++++++++ 1 file changed, 8 insertions(+)
target-ppc/translate_init.c +8 -0
@@ -28,6 +28,7 @@#include <kvm.h> #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR
@@ -10037,6 +10038,8 @@ static int ppc_fixup_cpu(CPUPPCState *env)int cpu_ppc_register_internal (CPUPPCState *env,const ppc_def_t *def) { +int max_smt =kvmppc_smt_threads (); + env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model;
@@ -10046,6 +10049,11 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) env->flags = def->flags; env->bfd_mach = def->bfd_mach; env->check_pow = def->check_pow; +if (smp_threads > max_smt){ +fprintf (stderr,"Cannot support more than %d threads on PPC with %s\n" , + max_smt,kvm_enabled () ?"KVM" :"TCG" ); +exit (1 ); + }#if defined(TARGET_PPC64 )if (def->sps)
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 1 line · David Gibson
From: Mike Qiu <[email protected]>
Oops, messed this one up, build error for user only builds. Fixed version below.
Quoted 1 line
From
d2cc6bcee4737647c4bbbf65d3c0129d4a119dd3Mon Sep 17 00:00:00 2001
From: Mike Qiu <[email protected]>
Date: Tue, 4 Dec 2012 10:52:14 +1100
Subject: [PATCH] target-ppc: Give a meaningful error if too many threads are
specified
Currently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors.
This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support.
--- target-ppc/translate_init.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
target-ppc/translate_init.c +12 -0
@@ -28,6 +28,7 @@#include <kvm.h> #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR
@@ -10037,6 +10038,10 @@ static int ppc_fixup_cpu(CPUPPCState *env)int cpu_ppc_register_internal (CPUPPCState *env,const ppc_def_t *def) { +#if !defined(CONFIG_USER_ONLY ) +int max_smt =kvmppc_smt_threads (); +#endif + env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model;
@@ -10046,6 +10051,13 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) env->flags = def->flags; env->bfd_mach = def->bfd_mach; env->check_pow = def->check_pow; +#if !defined(CONFIG_USER_ONLY ) +if (smp_threads > max_smt) { +fprintf (stderr,"Cannot support more than %d threads on PPC with %s\n" , + max_smt,kvm_enabled () ?"KVM" :"TCG" ); +exit (1 ); + } +#endif #if defined(TARGET_PPC64 )if (def->sps)
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 39 lines · David Gibson
Quoted 1 line · David Gibson
From: Mike Qiu <[email protected]>
Oops, messed this one up, build error for user only builds. Fixed version below.
From
d2cc6bcee4737647c4bbbf65d3c0129d4a119dd3Mon Sep 17 00:00:00 2001
From: Mike Qiu <[email protected]>
Date: Tue, 4 Dec 2012 10:52:14 +1100
Subject: [PATCH] target-ppc: Give a meaningful error if too many threads are specifiedCurrently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors.
This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support.
Signed-off-by Mike Qiu <[email protected]>Signed-off-by David Gibson <[email protected]>---
target-ppc/translate_init.c| 12 ++++++++++++1 file changed, 12 insertions(+)target-ppc/translate_init.c +1
-0@@ -28,6 +28,7 @@#include <kvm.h> #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR
target-ppc/translate_init.c static int ppc_fixup_cpu(CPUPPCState *env) · line 10042
Quoted 5 lines
target-ppc/translate_init.c +2
-0@@ -10037,6 +10038,10 @@ static int ppc_fixup_cpu(CPUPPCState *env)int cpu_ppc_register_internal (CPUPPCState *env,const ppc_def_t *def) { +#if !defined(CONFIG_USER_ONLY ) +int max_smt =kvmppc_smt_threads ();
What if I am using TCG on PPC?
Alex
Quoted 26 lines
target-ppc/translate_init.c +9
-0+#endif + env->msr_mask = def->msr_mask; env->mmu_model = def->mmu_model; env->excp_model = def->excp_model;@@ -10046,6 +10051,13 @@ int cpu_ppc_register_internal (CPUPPCState *env, const ppc_def_t *def) env->flags = def->flags; env->bfd_mach = def->bfd_mach; env->check_pow = def->check_pow; +#if !defined(CONFIG_USER_ONLY ) +if (smp_threads > max_smt) { +fprintf (stderr,"Cannot support more than %d threads on PPC with %s\n" , + max_smt,kvm_enabled () ?"KVM" :"TCG" ); +exit (1 ); + } +#endif #if defined(TARGET_PPC64 )if (def->sps)Signature · 5 lines
-- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 43 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 1 line · David Gibson
From: Mike Qiu <[email protected]>
Oops, messed this one up, build error for user only builds. Fixed version below.
From
d2cc6bcee4737647c4bbbf65d3c0129d4a119dd3Mon Sep 17 00:00:00 2001
From: Mike Qiu <[email protected]>
Date: Tue, 4 Dec 2012 10:52:14 +1100
Subject: [PATCH] target-ppc: Give a meaningful error if too many threads are specifiedCurrently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors.
This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support.
Signed-off-by Mike Qiu <[email protected]>Signed-off-by David Gibson <[email protected]>---
target-ppc/translate_init.c| 12 ++++++++++++1 file changed, 12 insertions(+)target-ppc/translate_init.c +1
-0@@ -28,6 +28,7 @@#include <kvm.h> #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10037,6 +10038,10 @@ static int ppc_fixup_cpu(CPUPPCState *env)
Quoted 6 lines
target-ppc/translate_init.c static int ppc_fixup_cpu(CPUPPCState *env) · line 10042
Quoted 4 lines
target-ppc/translate_init.c +2
-0int cpu_ppc_register_internal (CPUPPCState *env,const ppc_def_t *def) { +#if !defined(CONFIG_USER_ONLY ) +int max_smt =kvmppc_smt_threads ();What if I am using TCG on PPC?
Then the stub version of kvmppc_smt_threads() returns 1, and since the PPC TCG doesn't do any SMT emulation, that would seem to be correct...
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 51 lines · David Gibson
Quoted 43 lines · Alexander Graf
Quoted 40 lines · David Gibson
Quoted 1 line · David Gibson
From: Mike Qiu <[email protected]>
Oops, messed this one up, build error for user only builds. Fixed version below.
From
d2cc6bcee4737647c4bbbf65d3c0129d4a119dd3Mon Sep 17 00:00:00 2001
From: Mike Qiu <[email protected]>
Date: Tue, 4 Dec 2012 10:52:14 +1100
Subject: [PATCH] target-ppc: Give a meaningful error if too many threads are specifiedCurrently the target-ppc tcg code only supports a single thread. You can specify more, but they're treated identically to multiple cores. On KVM we obviously can't support more threads than the hardware; if more are specified it will cause strange and cryptic errors.
This patch clarifies the situation by giving a simple meaningful error if more threads are specified than we can support.
Signed-off-by Mike Qiu <[email protected]>Signed-off-by David Gibson <[email protected]>---
target-ppc/translate_init.c| 12 ++++++++++++1 file changed, 12 insertions(+)target-ppc/translate_init.c +1
-0@@ -28,6 +28,7 @@#include <kvm.h> #include "kvm_ppc.h" #include "arch_init.h" +#include "cpus.h" //#define PPC_DUMP_CPU //#define PPC_DEBUG_SPR @@ -10037,6 +10038,10 @@ static int ppc_fixup_cpu(CPUPPCState *env)Quoted 6 lines
target-ppc/translate_init.c static int ppc_fixup_cpu(CPUPPCState *env) · line 10042
Quoted 4 lines
target-ppc/translate_init.c +2
-0int cpu_ppc_register_internal (CPUPPCState *env,const ppc_def_t *def) { +#if !defined(CONFIG_USER_ONLY ) +int max_smt =kvmppc_smt_threads ();What if I am using TCG on PPC?
Quoted 2 lines
Then the stub version of
kvmppc_smt_threads()returns 1, and since the PPC TCG doesn't do any SMT emulation, that would seem to be correct...
int kvmppc_smt_threads(void)
{
return cap_ppc_smt ? cap_ppc_smt : 1;
}So because we don't call kvm_arch_init, the cap is 0 and thus we return 1? That's quite hard to follow :).
Please make this explicit. Only call kvmppc_smt_threads() when kvm_enabled().
Alex
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 9 lines · Alexander Graf
Quoted 5 lines · David Gibson
Quoted 1 line · Alexander Graf
What if I am using TCG on PPC?
Then the stub version of
kvmppc_smt_threads()returns 1, and since the PPC TCG doesn't do any SMT emulation, that would seem to be correct...
Quoted 6 lines
int
kvmppc_smt_threads(void){ return cap_ppc_smt ? cap_ppc_smt : 1; }So because we don't call
kvm_arch_init, the cap is 0 and thus we return 1?
No, if we aren't CONFIG_KVM then that source file and version of the function aren't compiled at all. David means the stub function, which is in kvm_ppc.h:
static inline int kvmppc_smt_threads(void)
{
return 1;
}(if you don't like stubs lurking in the header file you could have a target-ppc/kvm-stub.c by analogy with the i386 one I suppose)
-- PMM
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 5 lines · Peter Maydell
Quoted 1 line · Alexander Graf
So because we don't call
kvm_arch_init, the cap is 0 and thus we return 1?No, if we aren't
CONFIG_KVMthen that source file and version of the function aren't compiled at all.
...and 5 seconds after sending that I realised what you actually meant. ignore me :-)
-- PMM
Re: [Qemu-devel] [PATCH 13/13] target-ppc: Give a meaningful error if too many threads are specified
Quoted 9 lines · Peter Maydell
Quoted 5 lines · Peter Maydell
Quoted 1 line · Alexander Graf
So because we don't call
kvm_arch_init, the cap is 0 and thus we return 1?No, if we aren't
CONFIG_KVMthen that source file and version of the function aren't compiled at all....and 5 seconds after sending that I realised what you actually meant. ignore me :-)
And a bit later, so did I. I'll revise.
Signature · 4 lines
David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson