[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 36/38] spapr: nested: Use correct source for parttbl info for nest
From: |
Nicholas Piggin |
Subject: |
[PULL 36/38] spapr: nested: Use correct source for parttbl info for nested PAPR API. |
Date: |
Wed, 13 Mar 2024 02:58:47 +1000 |
From: Harsh Prateek Bora <harshpb@linux.ibm.com>
For nested PAPR API, we use SpaprMachineStateNestedGuest struct to store
partition table info, use the same in spapr_get_pate_nested() via
helper.
Reviewed-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Neuling <mikey@neuling.org>
Signed-off-by: Harsh Prateek Bora <harshpb@linux.ibm.com>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
hw/ppc/spapr.c | 6 +++--
hw/ppc/spapr_nested.c | 41 ++++++++++++++++++++++++++---------
include/hw/ppc/spapr_nested.h | 2 ++
3 files changed, 37 insertions(+), 12 deletions(-)
diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c
index e001ffe06f..aaf73781b0 100644
--- a/hw/ppc/spapr.c
+++ b/hw/ppc/spapr.c
@@ -1421,11 +1421,13 @@ static bool spapr_get_pate(PPCVirtualHypervisor *vhyp,
PowerPCCPU *cpu,
entry->dw1 = spapr->patb_entry;
return true;
} else {
- assert(spapr_nested_api(spapr));
if (spapr_nested_api(spapr) == NESTED_API_KVM_HV) {
return spapr_get_pate_nested_hv(spapr, cpu, lpid, entry);
+ } else if (spapr_nested_api(spapr) == NESTED_API_PAPR) {
+ return spapr_get_pate_nested_papr(spapr, cpu, lpid, entry);
+ } else {
+ g_assert_not_reached();
}
- return false;
}
}
diff --git a/hw/ppc/spapr_nested.c b/hw/ppc/spapr_nested.c
index cea282926f..1a5cb254c9 100644
--- a/hw/ppc/spapr_nested.c
+++ b/hw/ppc/spapr_nested.c
@@ -58,6 +58,31 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr,
PowerPCCPU *cpu,
return true;
}
+static
+SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState *spapr,
+ target_ulong guestid)
+{
+ SpaprMachineStateNestedGuest *guest;
+
+ guest = g_hash_table_lookup(spapr->nested.guests,
GINT_TO_POINTER(guestid));
+ return guest;
+}
+
+bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu,
+ target_ulong lpid, ppc_v3_pate_t *entry)
+{
+ SpaprMachineStateNestedGuest *guest;
+ assert(lpid != 0);
+ guest = spapr_get_nested_guest(spapr, lpid);
+ if (!guest) {
+ return false;
+ }
+
+ entry->dw0 = guest->parttbl[0];
+ entry->dw1 = guest->parttbl[1];
+ return true;
+}
+
#define PRTS_MASK 0x1f
static target_ulong h_set_ptbl(PowerPCCPU *cpu,
@@ -540,16 +565,6 @@ void spapr_exit_nested(PowerPCCPU *cpu, int excp)
}
}
-static
-SpaprMachineStateNestedGuest *spapr_get_nested_guest(SpaprMachineState *spapr,
- target_ulong guestid)
-{
- SpaprMachineStateNestedGuest *guest;
-
- guest = g_hash_table_lookup(spapr->nested.guests,
GINT_TO_POINTER(guestid));
- return guest;
-}
-
static bool spapr_nested_vcpu_check(SpaprMachineStateNestedGuest *guest,
target_ulong vcpuid, bool inoutbuf)
{
@@ -1590,6 +1605,12 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr,
PowerPCCPU *cpu,
return false;
}
+bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu,
+ target_ulong lpid, ppc_v3_pate_t *entry)
+{
+ return false;
+}
+
void spapr_register_nested_papr(void)
{
/* DO NOTHING */
diff --git a/include/hw/ppc/spapr_nested.h b/include/hw/ppc/spapr_nested.h
index bf9b258c29..93ef14adcc 100644
--- a/include/hw/ppc/spapr_nested.h
+++ b/include/hw/ppc/spapr_nested.h
@@ -519,4 +519,6 @@ bool spapr_get_pate_nested_hv(SpaprMachineState *spapr,
PowerPCCPU *cpu,
target_ulong lpid, ppc_v3_pate_t *entry);
uint8_t spapr_nested_api(SpaprMachineState *spapr);
void spapr_nested_gsb_init(void);
+bool spapr_get_pate_nested_papr(SpaprMachineState *spapr, PowerPCCPU *cpu,
+ target_ulong lpid, ppc_v3_pate_t *entry);
#endif /* HW_SPAPR_NESTED_H */
--
2.42.0
- [PULL 34/38] spapr: nested: Initialize the GSB elements lookup table., (continued)
- [PULL 34/38] spapr: nested: Initialize the GSB elements lookup table., Nicholas Piggin, 2024/03/12
- [PULL 27/38] spapr: nested: Introduce SpaprMachineStateNested to store related info., Nicholas Piggin, 2024/03/12
- [PULL 31/38] spapr: nested: Introduce H_GUEST_[CREATE|DELETE] hcalls., Nicholas Piggin, 2024/03/12
- [PULL 33/38] spapr: nested: Extend nested_ppc_state for nested PAPR API, Nicholas Piggin, 2024/03/12
- [PULL 35/38] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls., Nicholas Piggin, 2024/03/12
[PULL 36/38] spapr: nested: Use correct source for parttbl info for nested PAPR API.,
Nicholas Piggin <=
[PULL 37/38] spapr: nested: Introduce H_GUEST_RUN_VCPU hcall., Nicholas Piggin, 2024/03/12
[PULL 38/38] spapr: nested: Introduce cap-nested-papr for Nested PAPR API, Nicholas Piggin, 2024/03/12
Re: [PULL 00/38] ppc-for-9.0-2 queue, Bernhard Beschow, 2024/03/12
Re: [PULL 00/38] ppc-for-9.0-2 queue, Peter Maydell, 2024/03/13