[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PULL 35/38] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls
From: |
Peter Maydell |
Subject: |
Re: [PULL 35/38] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls. |
Date: |
Tue, 26 Mar 2024 16:02:24 +0000 |
On Tue, 12 Mar 2024 at 17:11, Nicholas Piggin <npiggin@gmail.com> wrote:
>
> From: Harsh Prateek Bora <harshpb@linux.ibm.com>
>
> Introduce the nested PAPR hcalls:
> - H_GUEST_GET_STATE which is used to get state of a nested guest or
> a guest VCPU. The value field for each element in the request is
> destination to be updated to reflect current state on success.
> - H_GUEST_SET_STATE which is used to modify the state of a guest or
> a guest VCPU. On success, guest (or its VCPU) state shall be
> updated as per the value field for the requested element(s).
>
> 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>
Hi; Coverity points out a problem with this code (CID 1540008, 1540009):
> +static target_ulong h_guest_getset_state(PowerPCCPU *cpu,
> + SpaprMachineState *spapr,
> + target_ulong *args,
> + bool set)
> +{
> + target_ulong flags = args[0];
> + target_ulong lpid = args[1];
> + target_ulong vcpuid = args[2];
> + target_ulong buf = args[3];
> + target_ulong buflen = args[4];
> + struct guest_state_request gsr;
> + SpaprMachineStateNestedGuest *guest;
> +
> + guest = spapr_get_nested_guest(spapr, lpid);
> + if (!guest) {
> + return H_P2;
> + }
> + gsr.buf = buf;
> + assert(buflen <= GSB_MAX_BUF_SIZE);
> + gsr.len = buflen;
> + gsr.flags = 0;
> + if (flags & H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) {
flags is a target_ulong, which means it might only be 32 bits.
But H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE has a bit set in the
upper 32 bits only. So Coverity complains about this condition
being always-zero and the body of the if being dead code.
What was the intention here?
> + gsr.flags |= GUEST_STATE_REQUEST_GUEST_WIDE;
> + }
> + if (flags & !H_GUEST_GETSET_STATE_FLAG_GUEST_WIDE) {
> + return H_PARAMETER; /* flag not supported yet */
> + }
> +
> + if (set) {
> + gsr.flags |= GUEST_STATE_REQUEST_SET;
> + }
> + return map_and_getset_state(cpu, guest, vcpuid, &gsr);
> +}
thanks
-- PMM
- [PULL 23/38] target/ppc: Clean up ifdefs in excp_helper.c, part 3, (continued)
- [PULL 23/38] target/ppc: Clean up ifdefs in excp_helper.c, part 3, Nicholas Piggin, 2024/03/12
- [PULL 26/38] spapr: nested: move nested part of spapr_get_pate into spapr_nested.c, Nicholas Piggin, 2024/03/12
- [PULL 29/38] spapr: nested: Document Nested PAPR API, Nicholas Piggin, 2024/03/12
- [PULL 28/38] spapr: nested: keep nested-hv related code restricted to its API., Nicholas Piggin, 2024/03/12
- [PULL 30/38] spapr: nested: Introduce H_GUEST_[GET|SET]_CAPABILITIES hcalls., Nicholas Piggin, 2024/03/12
- [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
- Re: [PULL 35/38] spapr: nested: Introduce H_GUEST_[GET|SET]_STATE hcalls.,
Peter Maydell <=
[PULL 36/38] spapr: nested: Use correct source for parttbl info for nested PAPR API., Nicholas Piggin, 2024/03/12
[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