From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vaibhav Jain Date: Fri, 02 Apr 2021 10:32:27 +0000 Subject: Re: [PATCH v2] ppc/spapr: Add support for implement support for H_SCM_HEALTH Message-Id: <8735w92djo.fsf@vajain21.in.ibm.com> List-Id: References: <20210401010519.7225-1-vaibhav@linux.ibm.com> <20210401075155.44b9267d@bahia.lan> In-Reply-To: <20210401075155.44b9267d@bahia.lan> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Greg Kurz , David Gibson Cc: xiaoguangrong.eric@gmail.com, mst@redhat.com, aneesh.kumar@linux.ibm.com, qemu-devel@nongnu.org, kvm-ppc@vger.kernel.org, shivaprasadbhat@gmail.com, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, imammedo@redhat.com, ehabkost@redhat.com Hi Greg, Thanks for looking into this patch. Greg Kurz writes: > On Thu, 1 Apr 2021 13:26:11 +1100 > David Gibson wrote: > >> On Thu, Apr 01, 2021 at 06:35:19AM +0530, Vaibhav Jain wrote: >> > Add support for H_SCM_HEALTH hcall described at [1] for spapr >> > nvdimms. This enables guest to detect the 'unarmed' status of a >> > specific spapr nvdimm identified by its DRC and if its unarmed, mark >> > the region backed by the nvdimm as read-only. >> > >> > The patch adds h_scm_health() to handle the H_SCM_HEALTH hcall which >> > returns two 64-bit bitmaps (health bitmap, health bitmap mask) derived >> > from 'struct nvdimm->unarmed' member. >> > >> > Linux kernel side changes to enable handling of 'unarmed' nvdimms for >> > ppc64 are proposed at [2]. >> > >> > References: >> > [1] "Hypercall Op-codes (hcalls)" >> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/powerpc/papr_hcalls.rst#n220 >> > [2] "powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe" >> > https://lore.kernel.org/linux-nvdimm/20210329113103.476760-1-vaibhav@linux.ibm.com/ >> > >> > Signed-off-by: Vaibhav Jain >> >> As well as the handful of comments below, this will definitely need to >> wait for ppc-6.1 at this point. >> >> > --- >> > Changelog >> > >> > v2: >> > * Added a check for drc->dev to ensure that the dimm is plugged in >> > when servicing H_SCM_HEALTH. [ Shiva ] >> > * Instead of accessing the 'nvdimm->unarmed' member directly use the >> > object_property_get_bool accessor to fetch it. [ Shiva ] >> > * Update the usage of PAPR_PMEM_UNARMED* macros [ Greg ] >> > * Updated patch description reference#1 to point appropriate section >> > in the documentation. [ Greg ] >> > --- >> > hw/ppc/spapr_nvdimm.c | 38 ++++++++++++++++++++++++++++++++++++++ >> > include/hw/ppc/spapr.h | 3 ++- >> > 2 files changed, 40 insertions(+), 1 deletion(-) >> > >> > diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c >> > index b46c36917c..34096e4718 100644 >> > --- a/hw/ppc/spapr_nvdimm.c >> > +++ b/hw/ppc/spapr_nvdimm.c >> > @@ -31,6 +31,13 @@ >> > #include "qemu/range.h" >> > #include "hw/ppc/spapr_numa.h" >> > >> > +/* DIMM health bitmap bitmap indicators. Taken from kernel's papr_scm.c */ >> > +/* SCM device is unable to persist memory contents */ >> > +#define PAPR_PMEM_UNARMED (1ULL << (63 - 0)) >> >> You can use PPC_BIT() for more clarity here. >> > > I had already suggested PPC_BIT(0) but since this macro was copied > from the kernel source, I've let Vaibhav decide whether to use > PPC_BIT() or keep the macro and comment it comes from the kernel. > > I agree I prefer PPC_BIT(0) :-) > Have switched to PPC_BIT in v3 >> > +/* Bits status indicators for health bitmap indicating unarmed dimm */ >> > +#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED) >> >> I'm not sure why you want two equal #defines here. >> > > Especially, this define doesn't make sense for the hypervisor IMHO. > > It is _just_ the mask of bits for the "unarmed" state in the kernel. > Have gotten rid of this define in v3. We can revisit this In future when support for more bits is added. >> > + >> > bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm, >> > uint64_t size, Error **errp) >> > { >> > @@ -467,6 +474,36 @@ static target_ulong h_scm_unbind_all(PowerPCCPU *cpu, SpaprMachineState *spapr, >> > return H_SUCCESS; >> > } >> > >> > +static target_ulong h_scm_health(PowerPCCPU *cpu, SpaprMachineState *spapr, >> > + target_ulong opcode, target_ulong *args) >> > +{ >> > + uint32_t drc_index = args[0]; >> > + SpaprDrc *drc = spapr_drc_by_index(drc_index); >> > + NVDIMMDevice *nvdimm; >> > + >> > + if (drc && spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { >> >> This will fail badly if !drc (given index is way out of bounds). I'm >> pretty sure you want >> if (!drc || spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { >> >> >> > + return H_PARAMETER; >> > + } >> > + >> > + /* Ensure that the dimm is plugged in */ >> > + if (!drc->dev) { >> > + return H_HARDWARE; >> >> H_HARDWARE doesn't seem right - it's the guest that has chosen to >> attempt this on an unplugged LMB, not the (virtual) hardware's fault. >> > > Yes. As already suggested, simply do the same as in other hcall > implementations in this file, e.g. from h_scm_bind_mem() : > > if (!drc || !drc->dev || > spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { > return H_PARAMETER; > } > Yes, have used the same construct in the fixed v3 >> > + } >> > + >> > + nvdimm = NVDIMM(drc->dev); >> > + >> > + args[0] = 0; >> > + /* Check if the nvdimm is unarmed and send its status via health bitmaps */ > > Not sure this comment is super useful. > Have reworked this function in v3. >> > + if (object_property_get_bool(OBJECT(nvdimm), NVDIMM_UNARMED_PROP, NULL)) { >> > + args[0] |= PAPR_PMEM_UNARMED; >> > + } >> > + >> > + /* Update the health bitmap with the applicable mask */ >> > + args[1] = PAPR_PMEM_UNARMED_MASK; > > I still think this is a misuse of PAPR_PMEM_UNARMED_MASK... The > meaning of args[1] is "health-bit-valid-bitmap indicate which > bits in health-bitmap are valid" according to the documentation. > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/powerpc/papr_hcalls.rst#n228 > > Without any further detail, I tend to consider this as a hint > to the guest on the bits supported by the hypervisor. Since > we can only set PAPR_PMEM_UNARMED, for now, args[1] should > be set to just that bit PAPR_PMEM_UNARMED. Other bits can > be added later if QEMU supports more of them. > Agree and addressed in v3. >> > + >> > + return H_SUCCESS; >> > +} >> > + >> > static void spapr_scm_register_types(void) >> > { >> > /* qemu/scm specific hcalls */ >> > @@ -475,6 +512,7 @@ static void spapr_scm_register_types(void) >> > spapr_register_hypercall(H_SCM_BIND_MEM, h_scm_bind_mem); >> > spapr_register_hypercall(H_SCM_UNBIND_MEM, h_scm_unbind_mem); >> > spapr_register_hypercall(H_SCM_UNBIND_ALL, h_scm_unbind_all); >> > + spapr_register_hypercall(H_SCM_HEALTH, h_scm_health); >> > } >> > >> > type_init(spapr_scm_register_types) >> > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h >> > index 47cebaf3ac..6e1eafb05d 100644 >> > --- a/include/hw/ppc/spapr.h >> > +++ b/include/hw/ppc/spapr.h >> > @@ -538,8 +538,9 @@ struct SpaprMachineState { >> > #define H_SCM_BIND_MEM 0x3EC >> > #define H_SCM_UNBIND_MEM 0x3F0 >> > #define H_SCM_UNBIND_ALL 0x3FC >> > +#define H_SCM_HEALTH 0x400 >> > >> > -#define MAX_HCALL_OPCODE H_SCM_UNBIND_ALL >> > +#define MAX_HCALL_OPCODE H_SCM_HEALTH >> > >> > /* The hcalls above are standardized in PAPR and implemented by pHyp >> > * as well. >> > -- Cheers ~ Vaibhav From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BE0C433B4 for ; Fri, 2 Apr 2021 10:22:03 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2AF5D61057 for ; Fri, 2 Apr 2021 10:22:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2AF5D61057 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:53424 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lSGwD-0005Yy-Sf for qemu-devel@archiver.kernel.org; Fri, 02 Apr 2021 06:22:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSGv6-00052D-Ru; Fri, 02 Apr 2021 06:20:52 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:59890 helo=mx0a-001b2d01.pphosted.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lSGv4-0006HY-Iw; Fri, 02 Apr 2021 06:20:52 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 132A4HnP196287; Fri, 2 Apr 2021 06:20:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : in-reply-to : references : date : message-id : content-type : mime-version; s=pp1; bh=N18DXA7RlcUuasxPvWDBjawFDujTbVzBJa5UrmPsA/k=; b=p6sjzXtkPZ3nSBEtaQbXwHFVH3ZHYZJ/5afER4o16FSYG90yGLBEQqLxyrwzDF0hqpa/ 6MC9jbtIMqUBkosI6HSNOdKMnJlMkJM2rulgZ74OBTCjXCC+q3nLxdgb5k6+xdoEx26s o+v096+Za14M4pcDYzgJP5jKCzFzl3oJAEMg/06ERwJBwlE7x06HBXQRyw7ieLRLBug2 7muYOLSnYAmBKfVT4dKM7+wtJ5/bqXzNF+JMvIJ5F77+1VxPnBHb+nttpaco5YepIYlu tNZWD2McGjFpPMS6ksTg14sz6HlfMsbWyfW/hUL/jmtVWRelIeQBic5LcUP06G43JpSt LQ== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37nbtch287-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Apr 2021 06:20:37 -0400 Received: from m0098414.ppops.net (m0098414.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 132AKbne045183; Fri, 2 Apr 2021 06:20:37 -0400 Received: from ppma04ams.nl.ibm.com (63.31.33a9.ip4.static.sl-reverse.com [169.51.49.99]) by mx0b-001b2d01.pphosted.com with ESMTP id 37nbtch27n-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Apr 2021 06:20:37 -0400 Received: from pps.filterd (ppma04ams.nl.ibm.com [127.0.0.1]) by ppma04ams.nl.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 132AIMXk002713; Fri, 2 Apr 2021 10:20:35 GMT Received: from b06cxnps3075.portsmouth.uk.ibm.com (d06relay10.portsmouth.uk.ibm.com [9.149.109.195]) by ppma04ams.nl.ibm.com with ESMTP id 37n28ts70d-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 02 Apr 2021 10:20:35 +0000 Received: from b06wcsmtp001.portsmouth.uk.ibm.com (b06wcsmtp001.portsmouth.uk.ibm.com [9.149.105.160]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 132AKXii39190832 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 2 Apr 2021 10:20:33 GMT Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2413BA4065; Fri, 2 Apr 2021 10:20:33 +0000 (GMT) Received: from b06wcsmtp001.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B679AA405B; Fri, 2 Apr 2021 10:20:28 +0000 (GMT) Received: from vajain21.in.ibm.com (unknown [9.102.3.66]) by b06wcsmtp001.portsmouth.uk.ibm.com (Postfix) with SMTP; Fri, 2 Apr 2021 10:20:28 +0000 (GMT) Received: by vajain21.in.ibm.com (sSMTP sendmail emulation); Fri, 02 Apr 2021 15:50:27 +0530 From: Vaibhav Jain To: Greg Kurz , David Gibson Subject: Re: [PATCH v2] ppc/spapr: Add support for implement support for H_SCM_HEALTH In-Reply-To: <20210401075155.44b9267d@bahia.lan> References: <20210401010519.7225-1-vaibhav@linux.ibm.com> <20210401075155.44b9267d@bahia.lan> Date: Fri, 02 Apr 2021 15:50:27 +0530 Message-ID: <8735w92djo.fsf@vajain21.in.ibm.com> Content-Type: text/plain X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: 3M7oveSi8zFALwhH1EzqwlVGGU52MVrW X-Proofpoint-GUID: b94HnSDXVodkQRi1xrgQcooY84iSkQHz X-Proofpoint-UnRewURL: 0 URL was un-rewritten MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369, 18.0.761 definitions=2021-04-02_06:2021-04-01, 2021-04-02 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 clxscore=1015 adultscore=0 priorityscore=1501 impostorscore=0 suspectscore=0 spamscore=0 phishscore=0 mlxlogscore=999 malwarescore=0 mlxscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2103310000 definitions=main-2104020070 Received-SPF: pass client-ip=148.163.158.5; envelope-from=vaibhav@linux.ibm.com; helo=mx0a-001b2d01.pphosted.com X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xiaoguangrong.eric@gmail.com, mst@redhat.com, aneesh.kumar@linux.ibm.com, qemu-devel@nongnu.org, kvm-ppc@vger.kernel.org, shivaprasadbhat@gmail.com, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, imammedo@redhat.com, ehabkost@redhat.com Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Hi Greg, Thanks for looking into this patch. Greg Kurz writes: > On Thu, 1 Apr 2021 13:26:11 +1100 > David Gibson wrote: > >> On Thu, Apr 01, 2021 at 06:35:19AM +0530, Vaibhav Jain wrote: >> > Add support for H_SCM_HEALTH hcall described at [1] for spapr >> > nvdimms. This enables guest to detect the 'unarmed' status of a >> > specific spapr nvdimm identified by its DRC and if its unarmed, mark >> > the region backed by the nvdimm as read-only. >> > >> > The patch adds h_scm_health() to handle the H_SCM_HEALTH hcall which >> > returns two 64-bit bitmaps (health bitmap, health bitmap mask) derived >> > from 'struct nvdimm->unarmed' member. >> > >> > Linux kernel side changes to enable handling of 'unarmed' nvdimms for >> > ppc64 are proposed at [2]. >> > >> > References: >> > [1] "Hypercall Op-codes (hcalls)" >> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/powerpc/papr_hcalls.rst#n220 >> > [2] "powerpc/papr_scm: Mark nvdimm as unarmed if needed during probe" >> > https://lore.kernel.org/linux-nvdimm/20210329113103.476760-1-vaibhav@linux.ibm.com/ >> > >> > Signed-off-by: Vaibhav Jain >> >> As well as the handful of comments below, this will definitely need to >> wait for ppc-6.1 at this point. >> >> > --- >> > Changelog >> > >> > v2: >> > * Added a check for drc->dev to ensure that the dimm is plugged in >> > when servicing H_SCM_HEALTH. [ Shiva ] >> > * Instead of accessing the 'nvdimm->unarmed' member directly use the >> > object_property_get_bool accessor to fetch it. [ Shiva ] >> > * Update the usage of PAPR_PMEM_UNARMED* macros [ Greg ] >> > * Updated patch description reference#1 to point appropriate section >> > in the documentation. [ Greg ] >> > --- >> > hw/ppc/spapr_nvdimm.c | 38 ++++++++++++++++++++++++++++++++++++++ >> > include/hw/ppc/spapr.h | 3 ++- >> > 2 files changed, 40 insertions(+), 1 deletion(-) >> > >> > diff --git a/hw/ppc/spapr_nvdimm.c b/hw/ppc/spapr_nvdimm.c >> > index b46c36917c..34096e4718 100644 >> > --- a/hw/ppc/spapr_nvdimm.c >> > +++ b/hw/ppc/spapr_nvdimm.c >> > @@ -31,6 +31,13 @@ >> > #include "qemu/range.h" >> > #include "hw/ppc/spapr_numa.h" >> > >> > +/* DIMM health bitmap bitmap indicators. Taken from kernel's papr_scm.c */ >> > +/* SCM device is unable to persist memory contents */ >> > +#define PAPR_PMEM_UNARMED (1ULL << (63 - 0)) >> >> You can use PPC_BIT() for more clarity here. >> > > I had already suggested PPC_BIT(0) but since this macro was copied > from the kernel source, I've let Vaibhav decide whether to use > PPC_BIT() or keep the macro and comment it comes from the kernel. > > I agree I prefer PPC_BIT(0) :-) > Have switched to PPC_BIT in v3 >> > +/* Bits status indicators for health bitmap indicating unarmed dimm */ >> > +#define PAPR_PMEM_UNARMED_MASK (PAPR_PMEM_UNARMED) >> >> I'm not sure why you want two equal #defines here. >> > > Especially, this define doesn't make sense for the hypervisor IMHO. > > It is _just_ the mask of bits for the "unarmed" state in the kernel. > Have gotten rid of this define in v3. We can revisit this In future when support for more bits is added. >> > + >> > bool spapr_nvdimm_validate(HotplugHandler *hotplug_dev, NVDIMMDevice *nvdimm, >> > uint64_t size, Error **errp) >> > { >> > @@ -467,6 +474,36 @@ static target_ulong h_scm_unbind_all(PowerPCCPU *cpu, SpaprMachineState *spapr, >> > return H_SUCCESS; >> > } >> > >> > +static target_ulong h_scm_health(PowerPCCPU *cpu, SpaprMachineState *spapr, >> > + target_ulong opcode, target_ulong *args) >> > +{ >> > + uint32_t drc_index = args[0]; >> > + SpaprDrc *drc = spapr_drc_by_index(drc_index); >> > + NVDIMMDevice *nvdimm; >> > + >> > + if (drc && spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { >> >> This will fail badly if !drc (given index is way out of bounds). I'm >> pretty sure you want >> if (!drc || spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { >> >> >> > + return H_PARAMETER; >> > + } >> > + >> > + /* Ensure that the dimm is plugged in */ >> > + if (!drc->dev) { >> > + return H_HARDWARE; >> >> H_HARDWARE doesn't seem right - it's the guest that has chosen to >> attempt this on an unplugged LMB, not the (virtual) hardware's fault. >> > > Yes. As already suggested, simply do the same as in other hcall > implementations in this file, e.g. from h_scm_bind_mem() : > > if (!drc || !drc->dev || > spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PMEM) { > return H_PARAMETER; > } > Yes, have used the same construct in the fixed v3 >> > + } >> > + >> > + nvdimm = NVDIMM(drc->dev); >> > + >> > + args[0] = 0; >> > + /* Check if the nvdimm is unarmed and send its status via health bitmaps */ > > Not sure this comment is super useful. > Have reworked this function in v3. >> > + if (object_property_get_bool(OBJECT(nvdimm), NVDIMM_UNARMED_PROP, NULL)) { >> > + args[0] |= PAPR_PMEM_UNARMED; >> > + } >> > + >> > + /* Update the health bitmap with the applicable mask */ >> > + args[1] = PAPR_PMEM_UNARMED_MASK; > > I still think this is a misuse of PAPR_PMEM_UNARMED_MASK... The > meaning of args[1] is "health-bit-valid-bitmap indicate which > bits in health-bitmap are valid" according to the documentation. > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/powerpc/papr_hcalls.rst#n228 > > Without any further detail, I tend to consider this as a hint > to the guest on the bits supported by the hypervisor. Since > we can only set PAPR_PMEM_UNARMED, for now, args[1] should > be set to just that bit PAPR_PMEM_UNARMED. Other bits can > be added later if QEMU supports more of them. > Agree and addressed in v3. >> > + >> > + return H_SUCCESS; >> > +} >> > + >> > static void spapr_scm_register_types(void) >> > { >> > /* qemu/scm specific hcalls */ >> > @@ -475,6 +512,7 @@ static void spapr_scm_register_types(void) >> > spapr_register_hypercall(H_SCM_BIND_MEM, h_scm_bind_mem); >> > spapr_register_hypercall(H_SCM_UNBIND_MEM, h_scm_unbind_mem); >> > spapr_register_hypercall(H_SCM_UNBIND_ALL, h_scm_unbind_all); >> > + spapr_register_hypercall(H_SCM_HEALTH, h_scm_health); >> > } >> > >> > type_init(spapr_scm_register_types) >> > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h >> > index 47cebaf3ac..6e1eafb05d 100644 >> > --- a/include/hw/ppc/spapr.h >> > +++ b/include/hw/ppc/spapr.h >> > @@ -538,8 +538,9 @@ struct SpaprMachineState { >> > #define H_SCM_BIND_MEM 0x3EC >> > #define H_SCM_UNBIND_MEM 0x3F0 >> > #define H_SCM_UNBIND_ALL 0x3FC >> > +#define H_SCM_HEALTH 0x400 >> > >> > -#define MAX_HCALL_OPCODE H_SCM_UNBIND_ALL >> > +#define MAX_HCALL_OPCODE H_SCM_HEALTH >> > >> > /* The hcalls above are standardized in PAPR and implemented by pHyp >> > * as well. >> > -- Cheers ~ Vaibhav