From nobody Sun May 19 01:26:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707910935; cv=none; d=zohomail.com; s=zohoarc; b=mfgS2rmLvc94ywdTE0t7bt+iBQmg/NrUo/y3Ry4RQ2nqbRyfFHksjjV8o60+1mNll2poP65PzD3GeEJQ2KKDzQLDBSRGTOpx6GWoQCzHbWx00AeId29z/MmG4kkkjQiVnCJ0zwCXOIZXRRquZicJ+TqPZ9I8pWYDk4uRraMEbNc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707910935; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=94Zht/z5Je72hcNo+d2tbsOKFvcKaoSfFgtITaQ3n5U=; b=M7SjMtMB9eVcbimJT0fF+52qh5TNHo4Jp8zCqfGwRiOCK9wBD+oe6bAsaBr8Rw2QyinROwozkO8cHsLd0NQRVrd2sC9GTBf3W7F2s40Gzt5FC185gmWK+XQQM1iSznMhzJzssCbT1o3iikkGPKMZ0RaqGFS4e1hV3EybdcjlEZs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1707910935247177.7261794349398; Wed, 14 Feb 2024 03:42:15 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.680617.1058642 (Exim 4.92) (envelope-from ) id 1raDeH-0005eC-4q; Wed, 14 Feb 2024 11:41:57 +0000 Received: by outflank-mailman (output) from mailman id 680617.1058642; Wed, 14 Feb 2024 11:41:57 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeH-0005e5-2E; Wed, 14 Feb 2024 11:41:57 +0000 Received: by outflank-mailman (input) for mailman id 680617; Wed, 14 Feb 2024 11:41:56 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeG-0005Pc-C4 for xen-devel@lists.xenproject.org; Wed, 14 Feb 2024 11:41:56 +0000 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [2a00:1450:4864:20::429]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0de73d36-cb2e-11ee-8a4d-1f161083a0e0; Wed, 14 Feb 2024 12:41:55 +0100 (CET) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-33b2960ff60so394416f8f.1 for ; Wed, 14 Feb 2024 03:41:55 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id x4-20020ac84d44000000b0042c4f46a994sm1934179qtv.75.2024.02.14.03.41.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:41:54 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0de73d36-cb2e-11ee-8a4d-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707910914; x=1708515714; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=94Zht/z5Je72hcNo+d2tbsOKFvcKaoSfFgtITaQ3n5U=; b=SW360cwWTfLDuLpOY9V1ckMfL2Kt97p8VYEqHCE8pqMVfaE6hsZHYQMrD+T0H7dhFY R1frgzZVSJ/a4zzRpWUQPnS0YaJ0c8dx1OXB84ZoUYgdBOuSsYrTtlfm5xtZkyUa6eED 2w9JAire+NWB+QQSPaLF0ToIOgXaQDOVCondY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910914; x=1708515714; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=94Zht/z5Je72hcNo+d2tbsOKFvcKaoSfFgtITaQ3n5U=; b=S6t8SlIC7Vhg5tOcOsb0mange8t+HrBDC/r6xf/09kMdvo87zofCXyTGSAtIsUK+YZ +gfNZgIZqvOOlRXdpUtYc1Xvfk6WSlvcaNFsilEUAHflAGtVVvPEW7eBSy2RVT6nZ4Po XoLYqyV/5cr0sZVyS2IHPoSKYgsWtzDWYcbllmbxjzOV7GqJZE4vfaE4FkaohxTvZL30 T1GE+RQMEAYxh0AlaAOBvJsKA/HMjkt4mkx5G9jyXQkUD4khs/nzCyyDvAm/LfG7Qe4S KIp8tW/NXWBp3aOclv4xVDrFGTtBWcQeauqnTiWckX7txbJqvCNcRxPkx41LBlJ0j6uv VNqw== X-Gm-Message-State: AOJu0YytBTQlVOIDwgEkuscssnvhAR0SK7iDjUtoIlnUCI11XlX/2Vct 4+VeSndL/cVZtwpB6HUI7Q/gW+kg0QDWMTevJSWNQcsrO7XPY2xNqx+JmDiMafmA+O0F+lZ7sd6 B X-Google-Smtp-Source: AGHT+IEkEoDh/AVgNK/zEUbyRj4HeKXLiM43nhLSJLRhxeMK+hvruqQDYd8uOhDgGtSNqa7Q9Z+CbA== X-Received: by 2002:a5d:6387:0:b0:33b:81b3:78a8 with SMTP id p7-20020a5d6387000000b0033b81b378a8mr1777186wru.18.1707910914756; Wed, 14 Feb 2024 03:41:54 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWey/ui9yHUSZHbl2yekfFjQ4UyqIIZVpK+rsjQvNtNmInYGZTW6tKzTJKzBHZ6pdX8SDkn/d9cysiCciMLbPln1flWtSSE/UZYrUgeRLnI From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Paul Durrant Subject: [PATCH 1/5] iommu/x86: fix IVMD/RMRR range checker loop increment Date: Wed, 14 Feb 2024 11:37:37 +0100 Message-ID: <20240214103741.16189-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214103741.16189-1-roger.pau@citrix.com> References: <20240214103741.16189-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707910937018100004 mfn_add() doesn't store the incremented value in the parameter, and instead returns it to the caller. As a result, the loop in iommu_unity_region_ok() didn't make progress. Fix it by storing the incremented value. Fixes: e45801dea17b ('iommu/x86: introduce a generic IVMD/RMRR range validi= ty helper') Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- xen/drivers/passthrough/x86/iommu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index 1c8cf3271a09..a3fa0aef7c37 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -804,7 +804,7 @@ bool __init iommu_unity_region_ok(const char *prefix, m= fn_t start, mfn_t end) "%s: [%#" PRI_mfn " ,%#" PRI_mfn "] is not (entirely) in reserv= ed memory\n", prefix, mfn_x(start), mfn_x(end)); =20 - for ( addr =3D start; mfn_x(addr) <=3D mfn_x(end); mfn_add(addr, 1) ) + for ( addr =3D start; mfn_x(addr) <=3D mfn_x(end); addr =3D mfn_add(ad= dr, 1) ) { unsigned int type =3D page_get_ram_type(addr); =20 --=20 2.43.0 From nobody Sun May 19 01:26:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707910936; cv=none; d=zohomail.com; s=zohoarc; b=WePKq/X8Sky7a0YDubE/pbWPtgm+SqxYpsudfIc27n+Q78SvINkhKV5VU/KHnHZs0Gp4Z1FqwbtMrFi5JfcDp8vE43Zt1Ou42F4mD0Ox4jE1qm4cLjFe54ao2eqboGNIgc1YCSeLOa32vHheEElktW7YexVSM7UaLlO2hpyk+UY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707910936; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=73EI9rqYbQp7NZhmMdmjrgOEumsFjhm+bWFGhs3mCc8=; b=nZM5BLc3jIvFEWyJ6wRqxTxS1e8y5Rj7gNSNOfDn5+/qAeOMnOu8KyjktAfAB82UI4BBuNNHVgvx2sI7hW/wh+V+xMKf0ekpc39jYDXbul+iFICWsh/KtEJLAfzbjNzXTv5aF3xWFHsoiTUgm6QvZjD3g++Xeno1cVf9mGZTQmk= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1707910936121465.71141223592065; Wed, 14 Feb 2024 03:42:16 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.680618.1058653 (Exim 4.92) (envelope-from ) id 1raDeK-0005uk-Ct; Wed, 14 Feb 2024 11:42:00 +0000 Received: by outflank-mailman (output) from mailman id 680618.1058653; Wed, 14 Feb 2024 11:42:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeK-0005ub-9W; Wed, 14 Feb 2024 11:42:00 +0000 Received: by outflank-mailman (input) for mailman id 680618; Wed, 14 Feb 2024 11:41:58 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeI-0005Pc-LU for xen-devel@lists.xenproject.org; Wed, 14 Feb 2024 11:41:58 +0000 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [2a00:1450:4864:20::134]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 0f56b977-cb2e-11ee-8a4d-1f161083a0e0; Wed, 14 Feb 2024 12:41:58 +0100 (CET) Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5116b540163so8124261e87.1 for ; Wed, 14 Feb 2024 03:41:58 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id qj14-20020a056214320e00b0068caf901c9bsm1083852qvb.17.2024.02.14.03.41.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:41:56 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 0f56b977-cb2e-11ee-8a4d-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707910917; x=1708515717; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=73EI9rqYbQp7NZhmMdmjrgOEumsFjhm+bWFGhs3mCc8=; b=u5nNhFq49z7LkTqpl0/tr54Y5FMVddD654IQu/VYyV9xtTV8ZQFMeYXlS3nwLhnez8 cMoTanBtXJnYdaP//rRViKZBzeQVjg5uJ495Z48zx8C24D8Gz0Z6Q1NPdvmhx10R7Zrt GDjrPCZtxC9eybwXVArQJxg6VInHzw1U0DK48= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910917; x=1708515717; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=73EI9rqYbQp7NZhmMdmjrgOEumsFjhm+bWFGhs3mCc8=; b=h9B8XvAe3EVSjluAWItPVqFS0CUp3Twxq9DZuSQ2vP2oyz5DCdCI22r2APXBKGfP+Q 3nYHQJivrr1WgWqAi5VPk8UDmNXe261jiZ6Xnuepw45QMOguNiYXsU2Y3QZBMvs+MGfI yC/24Q7YOBVl+SvZldb8retpwMvqAxx4yvOvGz5LNJpfQkPdd13m3ZS/qZck2liqdBPu 3ds1euWKGMfhRcDWAdfW2U10gbJjKpb0OC0Y+yZKOqgE4tk0sW/scVZPRtiZGos2eFqu QLwcXUjIN5zT+pMBYwRv3Ru1z9Am0chWZG7zrbbLdAU2hFlTAf5PQaIJj6vPv+/dDWex eonw== X-Gm-Message-State: AOJu0YzqwTYR2QQf13xYbo/77A7q1jtq9Yudjk688DAajN+RVj0D6N5f BSn5Z7baBB4sQpZ6I7+lK26N5JdwjhvJ0DFK2ie8wE3EJwSrDrBuJVS4E/UBjHR27lcrI0dznHA C X-Google-Smtp-Source: AGHT+IG0tJEU3fhJjIJ8NVl/QPwMLbE9iPLosJcRNbPHOIyIxybONmcE5i6MHKjeI9QyOeaQmhEJBg== X-Received: by 2002:a05:6512:4843:b0:511:7f28:f8e8 with SMTP id ep3-20020a056512484300b005117f28f8e8mr1510839lfb.63.1707910917127; Wed, 14 Feb 2024 03:41:57 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVfH3/g35RuDyhvzIfATZTTLIR2rJynU8TdLm5oAGqUbVOCHC9mYTayvxWXVzvpn9gwU/oGC2j9x/ljvXoGP3Z7IqmXEDmRGsK+oixE8XlwVsVqE9OtSiJ38X+XqfSohaj1ZzbBpfu+Re8j From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Paul Durrant , Andrew Cooper Subject: [PATCH 2/5] iommu/x86: print RMRR/IVMD ranges using full addresses Date: Wed, 14 Feb 2024 11:37:38 +0100 Message-ID: <20240214103741.16189-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214103741.16189-1-roger.pau@citrix.com> References: <20240214103741.16189-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707910937017100003 It's easier to correlate with the physical memory map if the addresses are fully printed, instead of using frame numbers. Requested-by: Andrew Cooper Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- xen/drivers/passthrough/x86/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index a3fa0aef7c37..304a2f5480c7 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -801,8 +801,8 @@ bool __init iommu_unity_region_ok(const char *prefix, m= fn_t start, mfn_t end) return true; =20 printk(XENLOG_WARNING - "%s: [%#" PRI_mfn " ,%#" PRI_mfn "] is not (entirely) in reserv= ed memory\n", - prefix, mfn_x(start), mfn_x(end)); + "%s: [%#lx, %#lx] is not (entirely) in reserved memory\n", + prefix, mfn_to_maddr(start), mfn_to_maddr(end)); =20 for ( addr =3D start; mfn_x(addr) <=3D mfn_x(end); addr =3D mfn_add(ad= dr, 1) ) { --=20 2.43.0 From nobody Sun May 19 01:26:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707910940; cv=none; d=zohomail.com; s=zohoarc; b=YrSyf3s4jvpAGtJrwc/CG83hKdI8AH58RAuSoYL6i37Cs4zu9Uuj2qpuTCcTUM5G9Zc5ek1ytAtbgUboZRVrqgyREFfgo31JJnLsrKfUX/cWqfm/DHun1arOOgZLoGlXaml9In0xZMDTH/hxcOZGAm7oQTPa8x/05fcYVN0iftE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707910940; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SKL9Cv8WHcDaH4CP4Lonu8yBimilzz26H15juTt/ZxA=; b=UIj7rUdfkLKxz1KCb50i+gazbGfCf8SymJtRHeS7LlyYYpCOJrbBsMrJOnnXPcvcwYHW3U9WEHbdgIchYPr746ZYCA+0bj6eprCPAQdQNLUOP3/fVMi1yCv2IMhYkLf+di6R3iccqNNI455wxmvDpS3KbLoU9NHNrHvG+AB7KGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 170791094005124.893036318463942; Wed, 14 Feb 2024 03:42:20 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.680620.1058663 (Exim 4.92) (envelope-from ) id 1raDeN-0006DT-Ka; Wed, 14 Feb 2024 11:42:03 +0000 Received: by outflank-mailman (output) from mailman id 680620.1058663; Wed, 14 Feb 2024 11:42:03 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeN-0006DK-GY; Wed, 14 Feb 2024 11:42:03 +0000 Received: by outflank-mailman (input) for mailman id 680620; Wed, 14 Feb 2024 11:42:02 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeM-0006Bc-Jn for xen-devel@lists.xenproject.org; Wed, 14 Feb 2024 11:42:02 +0000 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [2a00:1450:4864:20::22a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 10b392fe-cb2e-11ee-98f5-efadbce2ee36; Wed, 14 Feb 2024 12:42:00 +0100 (CET) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2d0fd07ba8bso35152041fa.1 for ; Wed, 14 Feb 2024 03:42:00 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id bi38-20020a05620a31a600b007872ed24739sm180347qkb.31.2024.02.14.03.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:41:59 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 10b392fe-cb2e-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707910919; x=1708515719; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SKL9Cv8WHcDaH4CP4Lonu8yBimilzz26H15juTt/ZxA=; b=nEe4aLtez9IXm9cX4kSlhp+yFykMDFn90VDMvr6IQYhSFu7r4oYvd8Gr5PBSRrD4J6 nbXzmt2sasTjduN8+bY2oS03WoEHuz7nVCXV9EYgrRMF9vXAD/7py+ZJk03Umc60trLp TxhHGiRAphBwZSVlHTFC658VQaB24Agv9yepY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910919; x=1708515719; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SKL9Cv8WHcDaH4CP4Lonu8yBimilzz26H15juTt/ZxA=; b=wId2IcD2gy8n4kVxlDO9PM2YrmO14VGM/Y70zTtxK/rdVAR8wW01ypWXNy+RpIErj3 4UxMJ422hImjkY6jtDjg5SpCg2vZ3xmrMoXIaC3gOOvItrrtZJNiyQoNomu3DO39wrni xVpwx0oJxFIMkZmiGXn7B17GujxouVHdBE50dn2gx0dBxaLFu9M8gkH7tBV1SOW0SZd9 pwt7OSsudSAaTCj6ZunBNPDWjVpPhjGKd4VDuKI+c/p9ZFbkoCYH93I7P+HQoCeYVDeP BmPWR4gcLAfSXnEvLNLbhoFjrumWxLuOYEwP28N3+m3oUCUI/sQfrhO7bcNhK3D2TXnF Nixw== X-Gm-Message-State: AOJu0YyVgWot4iQhzV/4/w5tjh9qvkeXhjPzBuRQuX9Ivc/VLDXNDus/ VjgMuUXC3VfqSGiCVYicTb3IUyOk8gbExgw2TxEBkOktENOEk5h7cRv1jR70WtqK+oQ6NC6WhcR o X-Google-Smtp-Source: AGHT+IHUsXy8zpz6Pkru0Y+FJ4gDPCuKjJ3J88fc19kB1QXCFNBgs5JRwin6PaWa+OJZ0ev+OgzL6g== X-Received: by 2002:a2e:9bd7:0:b0:2d0:b464:a9b1 with SMTP id w23-20020a2e9bd7000000b002d0b464a9b1mr1782333ljj.4.1707910919383; Wed, 14 Feb 2024 03:41:59 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVoumRfLLegYsfIk0OlRRhL1cxE/bp5SDNpmxtiua8EizwJKwUX8BArraMIUl0wj0hJ2jKP0AtR05o5kO9FmvnRBd9+V+rSutBzGOkNv+cfPzEtV1HNQV1uxM2VRTQllPnC+ZptTBTenXNm From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Paul Durrant , Andrew Cooper Subject: [PATCH 3/5] iommu/x86: use full addresses internally for the IVMD/RMRR range checks Date: Wed, 14 Feb 2024 11:37:39 +0100 Message-ID: <20240214103741.16189-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214103741.16189-1-roger.pau@citrix.com> References: <20240214103741.16189-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707910941029100001 Adjust the code in the checker to use full addresses rather than frame numb= ers, as it's only page_get_ram_type() that requires an mfn parameter. Suggested-by: Andrew Cooper Signed-off-by: Roger Pau Monn=C3=A9 --- xen/drivers/passthrough/x86/iommu.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index 304a2f5480c7..e713cf803e8a 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -794,28 +794,26 @@ __initcall(adjust_irq_affinities); =20 bool __init iommu_unity_region_ok(const char *prefix, mfn_t start, mfn_t e= nd) { - mfn_t addr; + paddr_t s =3D mfn_to_maddr(start), e =3D mfn_to_maddr(end); =20 - if ( e820_all_mapped(mfn_to_maddr(start), mfn_to_maddr(end) + PAGE_SIZ= E, - E820_RESERVED) ) + if ( e820_all_mapped(s, e + PAGE_SIZE, E820_RESERVED) ) return true; =20 printk(XENLOG_WARNING "%s: [%#lx, %#lx] is not (entirely) in reserved memory\n", - prefix, mfn_to_maddr(start), mfn_to_maddr(end)); + prefix, s, e); =20 - for ( addr =3D start; mfn_x(addr) <=3D mfn_x(end); addr =3D mfn_add(ad= dr, 1) ) + for ( paddr_t addr =3D s; addr <=3D e; addr +=3D PAGE_SIZE ) { - unsigned int type =3D page_get_ram_type(addr); + unsigned int type =3D page_get_ram_type(maddr_to_mfn(addr)); =20 if ( type =3D=3D RAM_TYPE_UNKNOWN ) { - if ( e820_add_range(mfn_to_maddr(addr), - mfn_to_maddr(addr) + PAGE_SIZE, E820_RESER= VED) ) + if ( e820_add_range(addr, addr + PAGE_SIZE, E820_RESERVED) ) continue; printk(XENLOG_ERR - "%s: page at %#" PRI_mfn " couldn't be reserved\n", - prefix, mfn_x(addr)); + "%s: page at %#lx couldn't be reserved\n", + prefix, paddr_to_pfn(addr)); return false; } =20 @@ -829,9 +827,8 @@ bool __init iommu_unity_region_ok(const char *prefix, m= fn_t start, mfn_t end) RAM_TYPE_UNUSABLE) ) continue; =20 - printk(XENLOG_ERR - "%s: page at %#" PRI_mfn " can't be converted\n", - prefix, mfn_x(addr)); + printk(XENLOG_ERR "%s: page at %#lx can't be converted\n", + prefix, paddr_to_pfn(addr)); return false; } =20 --=20 2.43.0 From nobody Sun May 19 01:26:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707910942; cv=none; d=zohomail.com; s=zohoarc; b=PiUbja9G4IIT8CXTGgdnMT9DB3nZQfI2eF/dhckR5TTezGElQFGa+RdzeSpLHYB5ruPre5YhXcaieh4O4lWYdEvDVZoLU1vyScWF8iV0bRXRfpqBfk2VedqTFjjUaRSA9sblDuJUiQ4XANUHT4WPn0EB2+lLkMZ/3H9LLx3H7wE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707910942; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=zbHWtGQxe+lF1Oh/RMVx/RWGcnqoQ1bvQB9vtnF0JLs=; b=E0C0003FfgRq0Xmq7LbRoUi57QyLZh/vLESsu3mL08oDHm9FzXYV3yxMFEz37CvYhshHiu1JpnUVFCgWuaG1hAqDW8UNIc/JMBAJK7iHm7FClxOl/wD9hZHjIiHl6e5VJbrxuQ5Ysjn7qsmNtIqoTx3Zd2HLcfcsLYIURUxLf1w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 170791094220943.56387329029235; Wed, 14 Feb 2024 03:42:22 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.680621.1058673 (Exim 4.92) (envelope-from ) id 1raDeO-0006Tx-T6; Wed, 14 Feb 2024 11:42:04 +0000 Received: by outflank-mailman (output) from mailman id 680621.1058673; Wed, 14 Feb 2024 11:42:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeO-0006Tq-PI; Wed, 14 Feb 2024 11:42:04 +0000 Received: by outflank-mailman (input) for mailman id 680621; Wed, 14 Feb 2024 11:42:03 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeN-0005Pc-1p for xen-devel@lists.xenproject.org; Wed, 14 Feb 2024 11:42:03 +0000 Received: from mail-lj1-x234.google.com (mail-lj1-x234.google.com [2a00:1450:4864:20::234]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 11f41b25-cb2e-11ee-8a4d-1f161083a0e0; Wed, 14 Feb 2024 12:42:02 +0100 (CET) Received: by mail-lj1-x234.google.com with SMTP id 38308e7fff4ca-2d0a4e1789cso63429811fa.3 for ; Wed, 14 Feb 2024 03:42:02 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id t27-20020a05620a035b00b00785367e5a93sm3725905qkm.77.2024.02.14.03.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:42:01 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 11f41b25-cb2e-11ee-8a4d-1f161083a0e0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707910921; x=1708515721; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zbHWtGQxe+lF1Oh/RMVx/RWGcnqoQ1bvQB9vtnF0JLs=; b=EYpQ//rDxIqwy1B+4GD0x8hPSRnVtDTLHzBFTJ2Hnx5DJNTCU9yFTcH4C1thxsqL6a W4SRlMeEmgwD1Mhyu/N0Nq4UqaD672Yf0Ajev47TOmgsd8iHmTEtSg+o33jgDcLud5DU 4n9Wa2knLdio+MxODqUcvz/LU7NHkt5UnHL2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910921; x=1708515721; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zbHWtGQxe+lF1Oh/RMVx/RWGcnqoQ1bvQB9vtnF0JLs=; b=mKVgHBj5O+Cj9CtuHET/JOD7OQyhhCCvUUIBefapmqvqH6Abp3r7Fo5fCNJWLDfLTC Kvvh97/D5IXSSAQJcspcTCpxkD3IKLyWx1REP1j8vAOUt26ElA21ibfDLJ4+BAWKDN7d Ba6mpFct3wro5GiPIxje7kSjJaDlhJhxKYavvdu1qwUBzJ6dTiKPOCvBKwHfx8VzplxL NCj5/5/oYyFYd+XfIx/jjIk0OsXtHBRkoFIuYVHg/1J1YhqDQbchg9ZNLcqQZI1qjqCp Q6wFcX6pHczbyeL/2QDS6yl7WCcorbnnPwOtA35X3nnX78ZlEK2dqj/RKCEfNxcqTL0z z53g== X-Gm-Message-State: AOJu0Yz/LRmKR4oVSN5pQ3YcAyR9lkgNnjwXYHMWaJWo+4c7wTpi5qGk PdnTQMKSAaFYvnSNxgw+zMBCEmUBNt46c87Dw20esoaRgbeWychd9CXPlIJETwb7rKTg3WdL73K C X-Google-Smtp-Source: AGHT+IGit4GnXlDQsJF49FMFMw89YetTn+GHy8FchTC0tzsg9sECFBGs3fbenu35rI3rLBMV31tpzA== X-Received: by 2002:a05:651c:151:b0:2d0:f8d7:a91c with SMTP id c17-20020a05651c015100b002d0f8d7a91cmr1741911ljd.52.1707910921603; Wed, 14 Feb 2024 03:42:01 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUIoLUKXv+O3lO+DQm8w35xbRtpWa1TiHlLqcDtv8HdUSV3S5HOln3aAlDvmfHXGpKEXTs7ptD7YkFg0uKVcLfTuoxR2AZ6VnQO3W3/WF61dzMvtunXuzIzsKFv35Xl+m2yov/Lms2Klb44 From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Paul Durrant , Andrew Cooper Subject: [PATCH 4/5] iommu/x86: print page type in IVMD/RMRR check in case of error Date: Wed, 14 Feb 2024 11:37:40 +0100 Message-ID: <20240214103741.16189-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214103741.16189-1-roger.pau@citrix.com> References: <20240214103741.16189-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707910943016100003 Provide more information in case the page can't be converted, and print the original type(s). Requested-by: Andrew Cooper Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- xen/drivers/passthrough/x86/iommu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/drivers/passthrough/x86/iommu.c b/xen/drivers/passthrough/= x86/iommu.c index e713cf803e8a..217409c29644 100644 --- a/xen/drivers/passthrough/x86/iommu.c +++ b/xen/drivers/passthrough/x86/iommu.c @@ -827,8 +827,8 @@ bool __init iommu_unity_region_ok(const char *prefix, m= fn_t start, mfn_t end) RAM_TYPE_UNUSABLE) ) continue; =20 - printk(XENLOG_ERR "%s: page at %#lx can't be converted\n", - prefix, paddr_to_pfn(addr)); + printk(XENLOG_ERR "%s: page at %#lx can't be converted (type %#x)\= n", + prefix, paddr_to_pfn(addr), type); return false; } =20 --=20 2.43.0 From nobody Sun May 19 01:26:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1707910947; cv=none; d=zohomail.com; s=zohoarc; b=isAa55ihcBAFPUWPIeiG05OOfmPFFV4CI/1mQpCPCz/CLqs31uM39VnSpkoydZE91osLvZiu2e6NmkdvhyF80WisUJ4dScBFW4HrMpNf9e/WNif0aZunxeeTSB/MVRw0137aVpVyLhaWtzHDmOZEVsiLlmRU93acMJIAPP/xHRU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707910947; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=GJNvqG2IGk9PsE23BxVL4PP6tdgbjCcG8XCSUoGj9SA=; b=fTxQapqQS0Mm7YQJD8eZnkuO5wtJVOfQCnxBlm6m7tpqMi1QTp/lfcMba4beOZvArtbdQsUiVWAGKNv/fpauqVZ38T+/4GPabyH/OSAi4hmD8IIbyYfbNznxi4QwQerJGF/Lj2fgW49AYL9aV8GK7PJlfFE0bwNipUqoSwXJeaU= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1707910947781502.52035744462023; Wed, 14 Feb 2024 03:42:27 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.680622.1058683 (Exim 4.92) (envelope-from ) id 1raDeR-0006nM-78; Wed, 14 Feb 2024 11:42:07 +0000 Received: by outflank-mailman (output) from mailman id 680622.1058683; Wed, 14 Feb 2024 11:42:07 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeR-0006n7-23; Wed, 14 Feb 2024 11:42:07 +0000 Received: by outflank-mailman (input) for mailman id 680622; Wed, 14 Feb 2024 11:42:06 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1raDeQ-0006Bc-07 for xen-devel@lists.xenproject.org; Wed, 14 Feb 2024 11:42:06 +0000 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [2a00:1450:4864:20::235]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 13158367-cb2e-11ee-98f5-efadbce2ee36; Wed, 14 Feb 2024 12:42:04 +0100 (CET) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2d0d7985dfdso75380661fa.2 for ; Wed, 14 Feb 2024 03:42:04 -0800 (PST) Received: from localhost ([213.195.118.74]) by smtp.gmail.com with ESMTPSA id bl20-20020a05620a1a9400b007871de8ec59sm1213626qkb.129.2024.02.14.03.42.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 03:42:03 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 13158367-cb2e-11ee-98f5-efadbce2ee36 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1707910924; x=1708515724; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GJNvqG2IGk9PsE23BxVL4PP6tdgbjCcG8XCSUoGj9SA=; b=fYam6ZkLBgALIdNuWAFx7UiX271DdFtImeyeOUyx0kknu/6atDJK797eneyGEVVYhS Re7FTwNIL6a7pRFuGgV2Iyr+2hpPlEB7IXFqUl91lG075/qjkC0lMAiyo+yDzpdRYj7E dH2BKL9+62Ej1Omt6nIJkUIPx44P07ojnFS/4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707910924; x=1708515724; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GJNvqG2IGk9PsE23BxVL4PP6tdgbjCcG8XCSUoGj9SA=; b=Jv1OUFNCs97A6mBuOwtiX8IwfECfW+cxMgtARfOKdbg2I09j5QnwKkGSmdrSJot9Yo fvym4KYl37Zbb+HKlqKILlXnPuLn4CkwTs1wEIq+Pq0VabNapjYSYBT44eFEwW5sdHhh JE3R5NwmPgUy6z5JenAXkSARBZWWtacd/GMsz1cZ3XXBQHYfiDaTNtGotEVobFMqQt/2 5+n1EDtMe8HXspF77yEV7Ju5Tzerm15h+WMBUnDaJujgdKkMpNTidvJRr5f797q/w/CQ ZpEi/FA6DWJEcbyZLlIphEI04JRhEQIop7w2AIYDDDFx0Q6B3lsi0/9BYzzmPldanmik zXQg== X-Gm-Message-State: AOJu0YwNYjinrEf71GABLCv30e9q9xxP6NHdHcR/nxqbKtKKfV6Oi9oZ 6jXy6f7JvR0ER0b/TQlDMgAkSpO9mCuBBhA6g8pb5qToX6b6s+yRRxPgxmdQYrZoB9zCEJJQbm7 V X-Google-Smtp-Source: AGHT+IERu49AGLIkPi283NJAq1+/A4S0ucosD9AQdE9Pv8SPP/1s0udEm7HZ9T+ks4n26Nx+Dh+bSQ== X-Received: by 2002:a05:651c:1425:b0:2d0:aa28:6f77 with SMTP id u37-20020a05651c142500b002d0aa286f77mr1534669lje.45.1707910923934; Wed, 14 Feb 2024 03:42:03 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUiClLFOh55PWam1Jc8L+bOL+KWodINot4ElxIAPkcWyyWduLUh/Prog/oIShPDXpmPyM3yEHr7dTmShha8Q3352O8rjla6S86V9p2imJdeYf6w26ogCW+bDGotQ1PWpRU9QYo/3P1p28QE3F9akc6c0XsZnqZDq11Gfk7rmbmUlusoxxZmcFHZ6gcDyeeTzaTBbc1XbKZZoEFkRSmCp1gcSLuILQsOZvtiYQ== From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Andrew Cooper , George Dunlap , Jan Beulich , Julien Grall , Stefano Stabellini , Wei Liu Subject: [PATCH 5/5] mm: add the __must_check attribute to {gfn,mfn}_add() Date: Wed, 14 Feb 2024 11:37:41 +0100 Message-ID: <20240214103741.16189-6-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240214103741.16189-1-roger.pau@citrix.com> References: <20240214103741.16189-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1707910949035100001 It's not obvious from the function itself whether the incremented value wil= l be stored in the parameter, or returned to the caller. That has leads to bugs= in the past as callers assume the incremented value is stored in the parameter. Add the __must_check attribute to the function to easily spot callers that don't consume the returned value, which signals an error in the caller logi= c. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Julien Grall --- xen/include/xen/mm-frame.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/xen/include/xen/mm-frame.h b/xen/include/xen/mm-frame.h index 922ae418807a..c25e836f255a 100644 --- a/xen/include/xen/mm-frame.h +++ b/xen/include/xen/mm-frame.h @@ -23,7 +23,7 @@ TYPE_SAFE(unsigned long, mfn); #undef mfn_x #endif =20 -static inline mfn_t mfn_add(mfn_t mfn, unsigned long i) +static inline mfn_t __must_check mfn_add(mfn_t mfn, unsigned long i) { return _mfn(mfn_x(mfn) + i); } @@ -62,7 +62,7 @@ TYPE_SAFE(unsigned long, gfn); #undef gfn_x #endif =20 -static inline gfn_t gfn_add(gfn_t gfn, unsigned long i) +static inline gfn_t __must_check gfn_add(gfn_t gfn, unsigned long i) { return _gfn(gfn_x(gfn) + i); } --=20 2.43.0