pseries and PPC pending patches
cover pseries and PPC pending patches
Alex,
Having updated for your latest merge upstream, here's my current pending set of pseries related patches. Note that 1/16 is an important bugfix reverting a broken patch of yours: old_portio is not gone, alas, so we still need the workaround to handle it for in the pseries PCI code. The rest are more minor cleanups working towards in-kernel XICS interrupt controller and savevm/migration.
PATCH 1/16 Revert "PPC: pseries: Remove hack for PIO window"
This reverts commit a178274efabcbbc5d44805b51def874e47051325.
Contrary to that commit's message, the users of old_portio are not all gone. In particular VGA still uses it via portio_list_add().
--- hw/spapr_pci.c | 44 +++++++++++++++++++++++++++++++++++++++++++- hw/spapr_pci.h | 2 +- 2 files changed, 44 insertions(+), 2 deletions(-)
hw/spapr_pci.c +43 -1
@@ -439,6 +439,43 @@ static void pci_spapr_set_irq(void *opaque, int irq_num, int level)qemu_set_irq (spapr_phb_lsi_qirq (phb, irq_num), level); } +static uint64_t spapr_io_read (void *opaque,hwaddr addr, +unsigned size) +{ +switch (size) { +case 1 : +return cpu_inb (addr); +case 2 : +return cpu_inw (addr); +case 4 : +return cpu_inl (addr); + } +assert (0 ); +} + +static void spapr_io_write (void *opaque,hwaddr addr, +uint64_t data,unsigned size) +{ +switch (size) { +case 1 : +cpu_outb (addr, data); +return ; +case 2 : +cpu_outw (addr, data); +return ; +case 4 : +cpu_outl (addr, data); +return ; + } +assert (0 ); +} + +static const MemoryRegionOps spapr_io_ops = { + .endianness =DEVICE_LITTLE_ENDIAN , + .read = spapr_io_read, + .write = spapr_io_write +}; +/* * MSI/MSIX memory region implementation. * The handler handles both MSI and MSIX.
@@ -508,9 +545,14 @@ static int spapr_phb_init(SysBusDevice *s)* old_portion are updated */ sprintf (namebuf,"%s.io" , sphb->dtbusname);memory_region_init (&sphb->iospace, namebuf,SPAPR_PCI_IO_WIN_SIZE ); +/* FIXME: fix to support multiple PHBs */ +memory_region_add_subregion (get_system_io (),0 , &sphb->iospace); +sprintf (namebuf,"%s.io-alias" , sphb->dtbusname); +memory_region_init_io (&sphb->iowindow, &spapr_io_ops, sphb, + namebuf,SPAPR_PCI_IO_WIN_SIZE );memory_region_add_subregion (get_system_memory (), sphb->io_win_addr, - &sphb->iospace); + &sphb->iowindow);/* As MSI/MSIX interrupts trigger by writing at MSI/MSIX vectors, * we need to allocate some memory to catch those writes coming
hw/spapr_pci.h +1 -1
@@ -44,7 +44,7 @@ typedef struct sPAPRPHBState {MemoryRegion memspace, iospace;hwaddr mem_win_addr, mem_win_size, io_win_addr, io_win_size;hwaddr msi_win_addr; -MemoryRegion memwindow, msiwindow; +MemoryRegion memwindow, iowindow, msiwindow;uint32_t dma_liobn;uint64_t dma_window_start;
Signature · 1 line
1.7.10.4
PATCH 2/16 target-ppc: Rework storage of VPA registration state
In reply to David GibsonWith PAPR guests, hypercalls allow registration of the Virtual Processor Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow for certain communication between the guest and hypervisor. Currently, we store the addresses of the three areas and the size of the dtl in CPUPPCState.
The SLB shadow and DTL are variable sized, with the size being retrieved from within the registered memory area at the hypercall time. This size can later be overwritten with other information, however, so we need to save the size as of registration time. We already do this for the DTL, but not for the SLB shadow, so this patch fixes that.
In addition, we change the storage of the VPA information to use fixed size integer types which will make life easier for syncing this data with KVM, which we will need in future.
--- target-ppc/cpu.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-ppc/cpu.h +3 -3
@@ -1045,9 +1045,9 @@ struct CPUPPCState {#endif #if defined(TARGET_PPC64 ) && !defined(CONFIG_USER_ONLY ) -hwaddr vpa_addr; -hwaddr slb_shadow_addr, slb_shadow_size; -hwaddr dtl_addr, dtl_size; +uint64_t vpa_addr; +uint64_t slb_shadow_addr, slb_shadow_size; +uint64_t dtl_addr, dtl_size;#endif /* TARGET_PPC64 */ int error_code;
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 02/16] target-ppc: Rework storage of VPA registration state
Quoted 12 lines · David Gibson
With PAPR guests, hypercalls allow registration of the Virtual Processor Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow for certain communication between the guest and hypervisor. Currently, we store the addresses of the three areas and the size of the dtl in CPUPPCState.
The SLB shadow and DTL are variable sized, with the size being retrieved from within the registered memory area at the hypercall time. This size can later be overwritten with other information, however, so we need to save the size as of registration time. We already do this for the DTL, but not for the SLB shadow, so this patch fixes that.
Quoted 5 lines
In addition, we change the storage of the VPA information to use fixed size integer types which will make life easier for syncing this data with KVM, which we will need in future.
Signed-off-by David Gibson <[email protected]>
The commit message seems to not match the patch contents. I'll fix that up.
Alex
Quoted 24 lines
---
target-ppc/cpu.h| 6 +++---1 file changed, 3 insertions(+), 3 deletions(-)target-ppc/cpu.h +3
-3@@ -1045,9 +1045,9 @@ struct CPUPPCState {#endif #if defined(TARGET_PPC64 ) && !defined(CONFIG_USER_ONLY ) -hwaddr vpa_addr; -hwaddr slb_shadow_addr, slb_shadow_size; -hwaddr dtl_addr, dtl_size; +uint64_t vpa_addr; +uint64_t slb_shadow_addr, slb_shadow_size; +uint64_t dtl_addr, dtl_size;#endif /* TARGET_PPC64 */ int error_code;Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [Qemu-ppc] [PATCH 02/16] target-ppc: Rework storage of VPA registration state
Quoted 15 lines · Alexander Graf
Quoted 12 lines · David Gibson
With PAPR guests, hypercalls allow registration of the Virtual Processor Area (VPA), SLB shadow and dispatch trace log (DTL), each of which allow for certain communication between the guest and hypervisor. Currently, we store the addresses of the three areas and the size of the dtl in CPUPPCState.
The SLB shadow and DTL are variable sized, with the size being retrieved from within the registered memory area at the hypercall time. This size can later be overwritten with other information, however, so we need to save the size as of registration time. We already do this for the DTL, but not for the SLB shadow, so this patch fixes that.
Quoted 8 lines
Quoted 5 lines
In addition, we change the storage of the VPA information to use fixed size integer types which will make life easier for syncing this data with KVM, which we will need in future.
Signed-off-by David Gibson <[email protected]>The commit message seems to not match the patch contents. I'll fix that up.
Sorry, thanks. I think the described change was in an earlier version, but I'm not sure wuite when it fell out.
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
PATCH 3/16 target-ppc: Extend FPU state for newer POWER CPUs
In reply to David GibsonThis patch adds some extra FPU state to CPUPPCState. Specifically, fpscr is extended to a target_ulong bits, since some recent (64 bit) CPUs now have more status bits than fit inside 32 bits. Also, we add the 32 VSR registers present on CPUs with VSX (these extend the standard FP regs, which together with the Altivec/VMX registers form a 64 x 128bit register file for VSX).
We don't actually support the instructions using these extra registers in TCG yet, but we still need a place to store the state so we can sync it with KVM and savevm/loadvm it. This patch updates the savevm code to not fail on the extended state, but also does not actually save it - that's a project for another patch.
---
v2:
* Used target_ulong instead of uint64_t, since the extended state is used
only on ppc64 targets.
* Fixed the TCG mapping of fpscr to match the new type.
--- target-ppc/cpu.h | 4 +++- target-ppc/machine.c | 8 ++++++-- target-ppc/translate.c | 29 ++++++++++++++++++----------- 3 files changed, 27 insertions(+), 14 deletions(-)
target-ppc/cpu.h +3 -1
@@ -963,7 +963,7 @@ struct CPUPPCState {/* floating point registers */ float64 fpr[32 ];/* floating point status and control register */ -uint32_t fpscr; +target_ulong fpscr;/* Next instruction pointer */ target_ulong nip;
@@ -1014,6 +1014,8 @@ struct CPUPPCState {/* Altivec registers */ ppc_avr_t avr[32 ];uint32_t vscr; +/* VSX registers */ +uint64_t vsr[32 ];/* SPE registers */ uint64_t spe_acc;uint32_t spe_fscr;
target-ppc/machine.c +6 -2
@@ -6,6 +6,7 @@ void cpu_save(QEMUFile *f, void *opaque) {CPUPPCState *env = (CPUPPCState *)opaque;unsigned int i, j; +uint32_t fpscr;for (i =0 ; i <32 ; i++)qemu_put_betls (f, &env->gpr[i]);
@@ -30,7 +31,8 @@ void cpu_save(QEMUFile *f, void *opaque) u.d = env->fpr[i];qemu_put_be64 (f, u.l); } -qemu_put_be32s (f, &env->fpscr); + fpscr = env->fpscr; +qemu_put_be32s (f, &fpscr);qemu_put_sbe32s (f, &env->access_type);#if defined(TARGET_PPC64 )qemu_put_betls (f, &env->asr);
@@ -90,6 +92,7 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id)CPUPPCState *env = (CPUPPCState *)opaque;unsigned int i, j;target_ulong sdr1; +uint32_t fpscr;for (i =0 ; i <32 ; i++)qemu_get_betls (f, &env->gpr[i]);
@@ -114,7 +117,8 @@ int cpu_load(QEMUFile *f, void *opaque, int version_id) u.l =qemu_get_be64 (f); env->fpr[i] = u.d; } -qemu_get_be32s (f, &env->fpscr); +qemu_get_be32s (f, &fpscr); + env->fpscr = fpscr;qemu_get_sbe32s (f, &env->access_type);#if defined(TARGET_PPC64 )qemu_get_betls (f, &env->asr);
target-ppc/translate.c +18 -11
@@ -68,7 +68,7 @@ static TCGv cpu_cfar;#endif static TCGv cpu_xer;static TCGv cpu_reserve; -static TCGv_i32 cpu_fpscr; +static TCGv cpu_fpscr;static TCGv_i32 cpu_access_type;#include "gen-icount.h"
@@ -163,8 +163,8 @@ void ppc_translate_init(void) offsetof(CPUPPCState , reserve_addr), "reserve_addr"); - cpu_fpscr =tcg_global_mem_new_i32 (TCG_AREG0 , - offsetof(CPUPPCState , fpscr),"fpscr" ); + cpu_fpscr =tcg_global_mem_new (TCG_AREG0 , + offsetof(CPUPPCState , fpscr),"fpscr" ); cpu_access_type =tcg_global_mem_new_i32 (TCG_AREG0 , offsetof(CPUPPCState , access_type),"access_type" );
@@ -2302,6 +2302,7 @@ GEN_FLOAT_B(neg, 0x08, 0x01, 0, PPC_FLOAT);/* mcrfs */ static void gen_mcrfs (DisasContext *ctx) { +TCGv tmp =tcg_temp_new ();int bfa;if (unlikely (!ctx->fpu_enabled)) {
@@ -2309,9 +2310,11 @@ static void gen_mcrfs(DisasContext *ctx)return ; } bfa =4 * (7 -crfS (ctx->opcode)); -tcg_gen_shri_i32 (cpu_crf[crfD (ctx->opcode)], cpu_fpscr, bfa); +tcg_gen_shri_tl (tmp, cpu_fpscr, bfa); +tcg_gen_trunc_tl_i32 (cpu_crf[crfD (ctx->opcode)], tmp); +tcg_temp_free (tmp);tcg_gen_andi_i32 (cpu_crf[crfD (ctx->opcode)], cpu_crf[crfD (ctx->opcode)],0xf ); -tcg_gen_andi_i32 (cpu_fpscr, cpu_fpscr, ~(0xF << bfa)); +tcg_gen_andi_tl (cpu_fpscr, cpu_fpscr, ~(0xF << bfa)); }/* mffs */
@@ -2322,7 +2325,7 @@ static void gen_mffs(DisasContext *ctx)return ; }gen_reset_fpstatus (); -tcg_gen_extu_i32_i64 (cpu_fpr[rD (ctx->opcode)], cpu_fpscr); +tcg_gen_extu_tl_i64 (cpu_fpr[rD (ctx->opcode)], cpu_fpscr);gen_compute_fprf (cpu_fpr[rD (ctx->opcode)],0 ,Rc (ctx->opcode) !=0 ); }
@@ -2346,7 +2349,8 @@ static void gen_mtfsb0(DisasContext *ctx)tcg_temp_free_i32 (t0); }if (unlikely (Rc (ctx->opcode) !=0 )) { -tcg_gen_shri_i32 (cpu_crf[1 ], cpu_fpscr,FPSCR_OX ); +tcg_gen_trunc_tl_i32 (cpu_crf[1 ], cpu_fpscr); +tcg_gen_shri_i32 (cpu_crf[1 ], cpu_crf[1 ],FPSCR_OX ); } }
@@ -2371,7 +2375,8 @@ static void gen_mtfsb1(DisasContext *ctx)tcg_temp_free_i32 (t0); }if (unlikely (Rc (ctx->opcode) !=0 )) { -tcg_gen_shri_i32 (cpu_crf[1 ], cpu_fpscr,FPSCR_OX ); +tcg_gen_trunc_tl_i32 (cpu_crf[1 ], cpu_fpscr); +tcg_gen_shri_i32 (cpu_crf[1 ], cpu_crf[1 ],FPSCR_OX ); }/* We can raise a differed exception */ gen_helper_float_check_status (cpu_env);
@@ -2397,7 +2402,8 @@ static void gen_mtfsf(DisasContext *ctx)gen_helper_store_fpscr (cpu_env, cpu_fpr[rB (ctx->opcode)], t0);tcg_temp_free_i32 (t0);if (unlikely (Rc (ctx->opcode) !=0 )) { -tcg_gen_shri_i32 (cpu_crf[1 ], cpu_fpscr,FPSCR_OX ); +tcg_gen_trunc_tl_i32 (cpu_crf[1 ], cpu_fpscr); +tcg_gen_shri_i32 (cpu_crf[1 ], cpu_crf[1 ],FPSCR_OX ); }/* We can raise a differed exception */ gen_helper_float_check_status (cpu_env);
@@ -2425,7 +2431,8 @@ static void gen_mtfsfi(DisasContext *ctx)tcg_temp_free_i64 (t0);tcg_temp_free_i32 (t1);if (unlikely (Rc (ctx->opcode) !=0 )) { -tcg_gen_shri_i32 (cpu_crf[1 ], cpu_fpscr,FPSCR_OX ); +tcg_gen_trunc_tl_i32 (cpu_crf[1 ], cpu_fpscr); +tcg_gen_shri_i32 (cpu_crf[1 ], cpu_crf[1 ],FPSCR_OX ); }/* We can raise a differed exception */ gen_helper_float_check_status (cpu_env);
@@ -9463,7 +9470,7 @@ void cpu_dump_state (CPUPPCState *env, FILE *f, fprintf_function cpu_fprintf,if ((i & (RFPL -1 )) == (RFPL -1 ))cpu_fprintf (f,"\n" ); } -cpu_fprintf (f,"FPSCR %08x\n" , env->fpscr); +cpu_fprintf (f,"FPSCR " TARGET_FMT_lx"\n" , env->fpscr);#if !defined(CONFIG_USER_ONLY ) cpu_fprintf(f, " SRR0 " TARGET_FMT_lx " SRR1 " TARGET_FMT_lx " PVR " TARGET_FMT_lx " VRSAVE " TARGET_FMT_lx "\n",
Signature · 1 line
1.7.10.4
PATCH 4/16 pseries: Clean up inconsistent variable name in xics.c
In reply to David GibsonThroughout xics.c 'nr' is used to refer to a global interrupt number, and 'server' is used to refer to an interrupt server number (i.e. CPU number). Except in icp_set_mfrr(), where 'nr' is used as a server number. Fix this confusing inconsistency.
--- hw/xics.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
hw/xics.c +3 -3
@@ -108,13 +108,13 @@ static void icp_set_cppr(struct icp_state *icp, int server, uint8_t cppr) } } -static void icp_set_mfrr (struct icp_state *icp,int nr,uint8_t mfrr) +static void icp_set_mfrr (struct icp_state *icp,int server,uint8_t mfrr) { -struct icp_server_state *ss = icp->ss + nr; +struct icp_server_state *ss = icp->ss + server; ss->mfrr = mfrr;if (mfrr <CPPR (ss)) { -icp_check_ipi (icp, nr); +icp_check_ipi (icp, server); } }
Signature · 1 line
1.7.10.4
PATCH 5/16 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
@@ -799,7 +799,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
@@ -548,7 +548,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
Re: [Qemu-devel] [PATCH 05/16] pseries: Use #define for XICS base irq number
Quoted 6 lines · David Gibson
From: 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 inspapr.c.
Quoted 6 lines
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.
Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Ben Herrenschmidt <[email protected]>
From: and Signed-off fields seem to not match.
Alex
Quoted 48 lines
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 2 +- hw/xics.c | 2 +- hw/xics.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-)hw/spapr.c +1
-1@@ -799,7 +799,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@@ -548,7 +548,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
Re: [Qemu-devel] [PATCH 05/16] pseries: Use #define for XICS base irq number
Quoted 9 lines · Alexander Graf
Quoted 6 lines · David Gibson
From: 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 inspapr.c.
Quoted 8 lines
Quoted 6 lines
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.
Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Ben Herrenschmidt <[email protected]>From: and Signed-off fields seem to not match.
Well.. it's a fuzzy case in signed-off practice. Both Michael and Ben have worked on the patch, Michael first. I then split the patch up for submission and had to make a judgement call as to who was the main author of that section. My best guess on the available information was Ben.
Michael, Ben, have anything to add?
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
PATCH 6/16 pseries: Cleanup duplications of ics_valid_irq() code
In reply to David GibsonA couple of places in xics.c open-coded the same logic as is already implemented in ics_valid_irq(). This patch fixes the code duplication.
--- hw/xics.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
hw/xics.c +2 -4
@@ -326,8 +326,7 @@ static void ics_eoi(struct ics_state *ics, int nr)qemu_irq xics_get_qirq (struct icp_state *icp,int irq) { -if ((irq < icp->ics->offset) - || (irq >= (icp->ics->offset + icp->ics->nr_irqs))) { +if (!ics_valid_irq (icp->ics, irq)) {return NULL ; }
@@ -336,8 +335,7 @@ qemu_irq xics_get_qirq(struct icp_state *icp, int irq)void xics_set_irq_type (struct icp_state *icp,int irq,bool lsi) { -assert ((irq >= icp->ics->offset) - && (irq < (icp->ics->offset + icp->ics->nr_irqs))); +assert (ics_valid_irq (icp->ics, irq)); icp->ics->irqs[irq - icp->ics->offset].lsi = lsi; }
Signature · 1 line
1.7.10.4
PATCH 7/16 pseries: Move XICS initialization before cpu initialization
In reply to David GibsonFrom: Ben Herrenschmidt <[email protected]>
Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.
--- hw/spapr.c | 12 +++++++----- hw/xics.c | 52 +++++++++++++++++++++++----------------------------- hw/xics.h | 3 ++- 3 files changed, 32 insertions(+), 35 deletions(-)
hw/spapr.c +7 -5
@@ -745,6 +745,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) spapr->htab_shift++; } +/* Set up Interrupt Controller before we create the VCPUs */ + spapr->icp =xics_system_init (smp_cpus *kvmppc_smt_threads () / smp_threads, +XICS_IRQS ); + spapr->next_irq =XICS_IRQ_BASE ; +/* init CPUs */ if (cpu_model ==NULL ) { cpu_model =kvm_enabled () ?"host" :"POWER7" ;
@@ -757,6 +762,8 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) } env = &cpu->env; +xics_cpu_setup (spapr->icp, env); +/* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init (env,TIMEBASE_FREQ );
@@ -796,11 +803,6 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) }g_free (filename); - -/* Set up Interrupt Controller */ - spapr->icp =xics_system_init (XICS_IRQS ); - spapr->next_irq =XICS_IRQ_BASE ; -/* Set up EPOW events infrastructure */ spapr_events_init (spapr);
hw/xics.c +23 -29
65 lines not on this page · raw message
hw/xics.h +2 -1
@@ -35,6 +35,7 @@ struct icp_state;qemu_irq xics_get_qirq (struct icp_state *icp,int irq);void xics_set_irq_type (struct icp_state *icp,int irq,bool lsi); -struct icp_state *xics_system_init (int nr_irqs); +struct icp_state *xics_system_init (int nr_servers,int nr_irqs); +void xics_cpu_setup (struct icp_state *icp,CPUPPCState *env);#endif /* __XICS_H__ */
Signature · 1 line
1.7.10.4
Re: [Qemu-devel] [PATCH 07/16] pseries: Move XICS initialization before cpu initialization
Quoted 10 lines · David Gibson
From: Ben Herrenschmidt <[email protected]>
Currently, the pseries machine initializes the cpus, then the XICS interrupt controller. However, to support the upcoming in-kernel XICS implementation we will need to initialize the irq controller before the vcpus. This patch makes the necesssary rearrangement. This means the xics init code can no longer auto-detect the number of cpus ("interrupt servers" in XICS terminology) and so we must pass that in explicitly from the platform code.
Quoted 2 lines
Signed-off-by Michael Ellerman <[email protected]>Signed-off-by Ben Herrenschmidt <[email protected]>
Same From/Signed-off mismatch again.
Alex
Quoted 130 lines
Signed-off-by David Gibson <[email protected]>---
hw/spapr.c | 12 +++++++----- hw/xics.c | 52 +++++++++++++++++++++++----------------------------- hw/xics.h | 3 ++- 3 files changed, 32 insertions(+), 35 deletions(-)hw/spapr.c +7
-5@@ -745,6 +745,11 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) spapr->htab_shift++; } +/* Set up Interrupt Controller before we create the VCPUs */ + spapr->icp =xics_system_init (smp_cpus *kvmppc_smt_threads () / smp_threads, +XICS_IRQS ); + spapr->next_irq =XICS_IRQ_BASE ; +/* init CPUs */ if (cpu_model ==NULL ) { cpu_model =kvm_enabled () ?"host" :"POWER7" ;@@ -757,6 +762,8 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) } env = &cpu->env; +xics_cpu_setup (spapr->icp, env); +/* Set time-base frequency to 512 MHz */ cpu_ppc_tb_init (env,TIMEBASE_FREQ );@@ -796,11 +803,6 @@ static void ppc_spapr_init(QEMUMachineInitArgs *args) }g_free (filename); - -/* Set up Interrupt Controller */ - spapr->icp =xics_system_init (XICS_IRQS ); - spapr->next_irq =XICS_IRQ_BASE ; -/* Set up EPOW events infrastructure */ spapr_events_init (spapr);hw/xics.c +23
-29@@ -507,42 +507,36 @@ static void xics_reset(void *opaque) } } -struct icp_state *xics_system_init (int nr_irqs) +void xics_cpu_setup (struct icp_state *icp,CPUPPCState *env) { -CPUPPCState *env; -int max_server_num; -struct icp_state *icp; -struct ics_state *ics; +struct icp_server_state *ss = &icp->ss[env->cpu_index]; - max_server_num =-1 ; -for (env = first_cpu; env !=NULL ; env = env->next_cpu) { -if (env->cpu_index > max_server_num) { - max_server_num = env->cpu_index; - } - } +assert (env->cpu_index < icp->nr_servers); - icp =g_malloc0 (sizeof (*icp)); - icp->nr_servers = max_server_num +1 ; - icp->ss =g_malloc0 (icp->nr_servers*sizeof (struct icp_server_state )); +switch (PPC_INPUT (env)) { +case PPC_FLAGS_INPUT_POWER7 : + ss->output = env->irq_inputs[POWER7_INPUT_INT ]; +break ; -for (env = first_cpu; env !=NULL ; env = env->next_cpu) { -struct icp_server_state *ss = &icp->ss[env->cpu_index]; +case PPC_FLAGS_INPUT_970 : + ss->output = env->irq_inputs[PPC970_INPUT_INT ]; +break ; -switch (PPC_INPUT (env)) { -case PPC_FLAGS_INPUT_POWER7 : - ss->output = env->irq_inputs[POWER7_INPUT_INT ]; -break ; +default : +fprintf (stderr,"XICS interrupt controller does not support this CPU " +"bus model\n" ); +abort (); + } +} -case PPC_FLAGS_INPUT_970 : - ss->output = env->irq_inputs[PPC970_INPUT_INT ]; -break ; +struct icp_state *xics_system_init (int nr_servers,int nr_irqs) +{ +struct icp_state *icp; +struct ics_state *ics; -default : -hw_error ("XICS interrupt model does not support this CPU bus " -"model\n" ); -exit (1 ); - } - } + icp =g_malloc0 (sizeof (*icp)); + icp->nr_servers = nr_servers; + icp->ss =g_malloc0 (icp->nr_servers*sizeof (struct icp_server_state )); ics =g_malloc0 (sizeof (*ics)); ics->nr_irqs = nr_irqs;hw/xics.h +2
-1@@ -35,6 +35,7 @@ struct icp_state;qemu_irq xics_get_qirq (struct icp_state *icp,int irq);void xics_set_irq_type (struct icp_state *icp,int irq,bool lsi); -struct icp_state *xics_system_init (int nr_irqs); +struct icp_state *xics_system_init (int nr_servers,int nr_irqs); +void xics_cpu_setup (struct icp_state *icp,CPUPPCState *env);#endif /* __XICS_H__ */ Signature · 1 line
1.7.10.4
PATCH 8/16 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
@@ -239,7 +239,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;
@@ -255,7 +255,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 9/16 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
@@ -298,7 +298,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 10/16 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
@@ -1013,3 +1013,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 11/16 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(CPUPPCState *env, sPAPREnvironment *spapr,
@@ -515,10 +512,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 ; }
@@ -559,6 +554,7 @@ struct icp_state *xics_system_init(int nr_servers, 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 12/16 target-pcc: Convert ppcemb_tlb_t to use fixed 64-bit RPN
In reply to David GibsonCurrently the ppcemb_tlb_t struct, used on a number of embedded ppc models to represent a TLB entry contains a hwaddr. That works reasonably for now, but is troublesome for saving the state, which we'll want to do in future. hwaddr is a large enough type to contain a physical address for any supported machine - and can thus, in theory at least, vary depending on what machines are enabled other than the one we're actually using right now (though in fact it doesn't for ppc). This makes it unsuitable for describing in vmstate.
This patch therefore changes ppcemb_tlb_t to use a fixed 64-bit integer which we know is sufficient for all the machines which use this structure.
--- 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
PATCH 13/16 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
@@ -655,6 +655,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
@@ -623,6 +623,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 14/16 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
PATCH 15/16 pseries: Fix bug in PCI MSI allocation
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
In one of the recent reworks to the XICS code, a bug was introduced where we use the wrong sense and allocate level interrupts instead of message interrupts for PCI MSIs. This patch fixes it.
--- hw/spapr_pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/spapr_pci.c +1 -1
@@ -351,7 +351,7 @@ static void rtas_ibm_change_msi(sPAPREnvironment *spapr,/* There is no cached config, allocate MSIs */ if (!phb->msi_table[ndev].nvec) { - irq =spapr_allocate_irq_block (req_num, true); + irq =spapr_allocate_irq_block (req_num, false);if (irq <0 ) {fprintf (stderr,"Cannot allocate MSIs for device#%d" , ndev);rtas_st (rets,0 ,-1 );/* Hardware error */
Signature · 1 line
1.7.10.4
PATCH 16/16 pseries: Generate unique LIOBNs for PCI host bridges
In reply to David GibsonFrom: Alexey Kardashevskiy <[email protected]>
In future (with VFIO) we will have multiple PCI host bridges on pseries. Each one needs a unique LIOBN (IOMMU id). At the moment we derive these from the pci domain number, but the whole notion of domain numbers on the qemu side is bogus and in any case they're not actually uniquely allocated at this point.
This patch, therefore uses a simple sequence counter to generate unique LIOBNs for PCI host bridges.
--- hw/spapr_pci.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
hw/spapr_pci.c +2 -1
@@ -521,6 +521,7 @@ static int spapr_phb_init(SysBusDevice *s)char *namebuf;int i;PCIBus *bus; +static int phbnum; sphb->dtbusname =g_strdup_printf ("pci@%" PRIx64, sphb->buid); namebuf =alloca (strlen (sphb->dtbusname) +32 );
@@ -572,7 +573,7 @@ static int spapr_phb_init(SysBusDevice *s) PCI_DEVFN(0, 0), PCI_NUM_PINS); phb->bus = bus; - sphb->dma_liobn =SPAPR_PCI_BASE_LIOBN | (pci_find_domain (bus) <<16 ); + sphb->dma_liobn =SPAPR_PCI_BASE_LIOBN | (++phbnum <<16 ); sphb->dma_window_start =0 ; sphb->dma_window_size =0x40000000 ; sphb->dma =spapr_tce_new_dma_context (sphb->dma_liobn, sphb->dma_window_size);
Signature · 1 line
1.7.10.4
Quoted 9 lines · David Gibson
Alex,
Having updated for your latest merge upstream, here's my current pending set of pseries related patches. Note that 1/16 is an important bugfix reverting a broken patch of yours:
old_portiois not gone, alas, so we still need the workaround to handle it for in the pseries PCI code. The rest are more minor cleanups working towards in-kernel XICS interrupt controller and savevm/migration.
I've applied patches 1,2,3,4,6 of the patch set. I'll check out the rest of the set when you sorted out the From/Signed-off mess and fixed the obvious typos (target-pcc? Please check read your patches ;))
Alex