Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1457276ybz; Thu, 16 Apr 2020 09:29:23 -0700 (PDT) X-Google-Smtp-Source: APiQypJOWK9Kvksjgkq++nCVQSUB1XN35Sm5NmckJYqSi6hX1/Hlcutw2pbRqrRlI4+/9K7OiDHu X-Received: by 2002:aa7:d64e:: with SMTP id v14mr20662160edr.19.1587054563125; Thu, 16 Apr 2020 09:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587054563; cv=none; d=google.com; s=arc-20160816; b=ZJK0O/kGOVMP6N5PLU8ow4xuyZWHnsys+jAHyKv3U46sApQ+VDvBbgtHKPddKub2pp eBXRurVV8xFqxqS7/5Ne8qflT5x4O184mRrFwthpi9Uvh58F+0zzD/QnecYjb8jI5eWR niM1DbrokyxoVvHfJAHJwVaKx2o5vsEDvJas46LW+Me0054AJV584z62F9sAZvHvtkr6 hP6JSnTXBfkbtzKdgxcIHpQ0LBlQPqiteLQq67cBgd0yaFvkLM2Gz4hKx7Tizq65ieDh vXojOduJReIHEiDu5Q8yRuo5sUSHGkd48wi6Moa+utN9zFBuJ27ruQg3hsMMNnzJDBaA Nv5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :mime-version:date:subject:cc:to:from; bh=dZEuX3le24QeU/CgmC6n+eJbXC1ADitoKtlfopjs/vE=; b=LcjZmqVeNWcHB6wkSsiMKn/zJW5GLTveecNtsrgTaaEURh+5mR/EvJ/0MDGLp2PMD4 2UgbwIBOS9nHNgDwTWpsSoUfSkhwpvOjG7yFtyG6PtAsXP0FAQ0DRHAkAonXlK4tmKI2 QuqKC8za638ks0xiNC/yy17nQ5NdPjX5KFcguBHu1lXYCsetLw7VkfjlbckRNMOteHWS 7ZyNPk+GddJ9olImoxe0KbtWnFyV9KNDhJDd1r72sQEvGIalOl9cK4L5iRqG/zRueCY8 5RM7gr2JCR7ZQPp566lCNM7WwZFQ5TgIFfHJ1NKBJKU2JqJsmYAIthawFiaRIKtLTKLD BjQg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c7si6544495edq.184.2020.04.16.09.28.55; Thu, 16 Apr 2020 09:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406255AbgDPQ10 (ORCPT + 99 others); Thu, 16 Apr 2020 12:27:26 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:18620 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391186AbgDPQ1Z (ORCPT ); Thu, 16 Apr 2020 12:27:25 -0400 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 03GG5wXP098341 for ; Thu, 16 Apr 2020 12:27:24 -0400 Received: from e06smtp01.uk.ibm.com (e06smtp01.uk.ibm.com [195.75.94.97]) by mx0a-001b2d01.pphosted.com with ESMTP id 30eqd7qvwn-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 16 Apr 2020 12:27:24 -0400 Received: from localhost by e06smtp01.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 16 Apr 2020 17:26:45 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp01.uk.ibm.com (192.168.101.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 16 Apr 2020 17:26:42 +0100 Received: from d06av24.portsmouth.uk.ibm.com (d06av24.portsmouth.uk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 03GGRHhJ52428924 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 16 Apr 2020 16:27:18 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D662942041; Thu, 16 Apr 2020 16:27:17 +0000 (GMT) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 763554204B; Thu, 16 Apr 2020 16:27:17 +0000 (GMT) Received: from pomme.tlslab.ibm.com (unknown [9.145.24.8]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Thu, 16 Apr 2020 16:27:17 +0000 (GMT) From: Laurent Dufour To: kvm-ppc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org Cc: paulus@samba.org, mpe@ellerman.id.au, linux-kernel@vger.kernel.org, Alexey Kardashevskiy , benh@kernel.crashing.org Subject: [PATCH] KVM: PPC: Book3S HV: read ibm,secure-memory nodes Date: Thu, 16 Apr 2020 18:27:15 +0200 X-Mailer: git-send-email 2.26.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 20041616-4275-0000-0000-000003C106C5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 20041616-4276-0000-0000-000038D68199 Message-Id: <20200416162715.45846-1-ldufour@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.676 definitions=2020-04-16_06:2020-04-14,2020-04-16 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 suspectscore=0 spamscore=0 clxscore=1015 bulkscore=0 priorityscore=1501 malwarescore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 adultscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2004160112 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The newly introduced ibm,secure-memory nodes supersede the ibm,uv-firmware's property secure-memory-ranges. Firmware will no more expose the secure-memory-ranges property so first read the new one and if not found rollback to the older one. Signed-off-by: Laurent Dufour --- arch/powerpc/kvm/book3s_hv_uvmem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/arch/powerpc/kvm/book3s_hv_uvmem.c b/arch/powerpc/kvm/book3s_hv_uvmem.c index 53b88cae3e73..ad950f8996e0 100644 --- a/arch/powerpc/kvm/book3s_hv_uvmem.c +++ b/arch/powerpc/kvm/book3s_hv_uvmem.c @@ -735,6 +735,20 @@ static u64 kvmppc_get_secmem_size(void) const __be32 *prop; u64 size = 0; + /* + * First try the new ibm,secure-memory nodes which supersede the + * secure-memory-ranges property. + * If we found somes, no need to read the deprecated one. + */ + for_each_compatible_node(np, NULL, "ibm,secure-memory") { + prop = of_get_property(np, "reg", &len); + if (!prop) + continue; + size += of_read_number(prop + 2, 2); + } + if (size) + return size; + np = of_find_compatible_node(NULL, NULL, "ibm,uv-firmware"); if (!np) goto out; -- 2.26.1