From nobody Fri Nov 22 13:43:19 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858923; cv=none; d=zohomail.com; s=zohoarc; b=EaS7GI6MUF87/Socz9jAWVZdLQMhVXxvWTNdx2jYcRGpThqaRGls0dq3T7qC8Cpq863YVI0Fd3KDmQCaggU9S76mrdzBDk3qrSmdJsd6DLZeXUrxK7HvKgu2WLAN3evAvjr9ZrSwh0sl1QKgAvHwRKsf4hNjf8QcpNKUHKx8LGs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858923; 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=9wb2Zg0RGsFll9U2ozXeIHtw+XG8+EPJB3Bp+jbvzsQ=; b=TOzwKa+Ylb8qd6aNnMhPcoeIoj8qH3aD6JZEBZf4gLCIJMRp8D9paVqmhd/mOUj6gjMo514GgMVmqA+65OS0UIE150QYoJLKbBnVtteqmsmq7F5P7SMO+vJh9SSfr4icpM7E1bfG/BM0mprOLaMs0gyPrVnAMzKN8GoRnlF/4BU= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858923608686.4943714119121; Thu, 16 May 2024 04:28:43 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723175.1127776 (Exim 4.92) (envelope-from ) id 1s7ZHc-0006bQ-S4; Thu, 16 May 2024 11:28:24 +0000 Received: by outflank-mailman (output) from mailman id 723175.1127776; Thu, 16 May 2024 11:28:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHc-0006bJ-PZ; Thu, 16 May 2024 11:28:24 +0000 Received: by outflank-mailman (input) for mailman id 723175; Thu, 16 May 2024 11:28:23 +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 1s7ZHb-0006b6-I7 for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:23 +0000 Received: from mail-ed1-x52f.google.com (mail-ed1-x52f.google.com [2a00:1450:4864:20::52f]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 67415070-1377-11ef-909d-e314d9c70b13; Thu, 16 May 2024 13:28:22 +0200 (CEST) Received: by mail-ed1-x52f.google.com with SMTP id 4fb4d7f45d1cf-572c65cea55so5922160a12.0 for ; Thu, 16 May 2024 04:28:22 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:21 -0700 (PDT) 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: 67415070-1377-11ef-909d-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858902; x=1716463702; 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=9wb2Zg0RGsFll9U2ozXeIHtw+XG8+EPJB3Bp+jbvzsQ=; b=g7wKBayxZQW2hP/3F3o+/3QY0FMUX11Lolz56PlL1BcipTtCM8EU2dOfsMDF099u5I 5/nSYuBv2hEjSCc8UKV56BN3HyjXWUDSTEypV251/IC0salJzWSCwzHIQChFveCkU9fK Xg1TIv0E0MMh0rLgg6OoyhRsk9y8Vt/OsDYukG6SjUUd2k8J5VLCjg9o4VLmDBb8Wx5c fNygT+MWsbcnmDheQrePOUJYtCp8k8s50eiNNOGplKuLywbUFYTRwk7d120BmSQ3oAcI nRY073JE+58KDWhXDFcSuJ3RNXgPSq4gcE43krDbX0hG+Uuad6YK3AlQM7lO7ZahrKyL w6aA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858902; x=1716463702; 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=9wb2Zg0RGsFll9U2ozXeIHtw+XG8+EPJB3Bp+jbvzsQ=; b=O1dgDcTsZV0h9uPukvovN41m7cOtKABh1gqhmgvqVzdDSwgz8kWSrWwZpGYkWuWjoZ N4Q5CV2naeiPvpZHNEhOCcnuJjSWplDv5L2VwgabSLe9Yy+vzJf4lHTsMK23lCAGaAcK Xo8dlSJSVQCyPdnyNbtO1Knpm96ZenF0Z4wO+iGBF0cGEQebvoIwHFsm0LteLLfnR4XJ jl7ZQGQNwz8NKvfNN6pQmbGGEAlxhCeFIIZn5/W6lVt54Ur/XMxRB9+SmtgBth1O7W2s 7WeirwOeLywaeInf9d7pZdhOxIEOXfAAlJSJ6SAfP5PFugPY6BQWphdxTW3w1UhGQZ16 TERw== X-Gm-Message-State: AOJu0Yxu/YYQQ6INtWau/r+355I7c8THe7xX6vdSf0mwk4cv7SAEXDbo ZZn3dL6KmCNCVnGGkBOlxqc+axa9oHF7jRnxyu6fnzOfa9J8LuiKNPWSpE3J X-Google-Smtp-Source: AGHT+IGSJea0rRaSHcwu8qEp0BoExYhQPeYNJ6GI0Qo2/ni19nG/mqFw9W2LQDFxddiHBZUnOB9Ueg== X-Received: by 2002:a05:6402:278c:b0:574:eb36:9cf5 with SMTP id 4fb4d7f45d1cf-574eb369d9fmr7759577a12.11.1715858901825; Thu, 16 May 2024 04:28:21 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , George Dunlap , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini Subject: [PATCH for-4.19? v3 1/6] x86/p2m: Add braces for better code clarity Date: Thu, 16 May 2024 11:28:08 +0000 Message-Id: <36cb7af0de191b6a8d64931225f21a42c2c04529.1715858136.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858925200100001 From: Petr Bene=C5=A1 No functional change. Signed-off-by: Petr Bene=C5=A1 Reviewed-by: Stefano Stabellini --- xen/arch/x86/mm/p2m.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index ce742c12e0..eb7996170d 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -106,6 +106,7 @@ void p2m_change_entry_type_global(struct domain *d, unsigned int i; for ( i =3D 0; i < MAX_ALTP2M; i++ ) + { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { struct p2m_domain *altp2m =3D d->arch.altp2m_p2m[i]; @@ -114,6 +115,7 @@ void p2m_change_entry_type_global(struct domain *d, change_entry_type_global(altp2m, ot, nt); p2m_unlock(altp2m); } + } } p2m_unlock(hostp2m); @@ -139,6 +141,7 @@ void p2m_memory_type_changed(struct domain *d) unsigned int i; for ( i =3D 0; i < MAX_ALTP2M; i++ ) + { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { struct p2m_domain *altp2m =3D d->arch.altp2m_p2m[i]; @@ -147,6 +150,7 @@ void p2m_memory_type_changed(struct domain *d) _memory_type_changed(altp2m); p2m_unlock(altp2m); } + } } p2m_unlock(hostp2m); -- 2.34.1 From nobody Fri Nov 22 13:43:19 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858921; cv=none; d=zohomail.com; s=zohoarc; b=KVTnIizCARFme62mu2nfa5/KAOJmDgu9zV2SvNCIfKw1PKLx1LKl9hHUz0ovWT55jPdk2YnPs1HNt5JXU38kPwe8xI580hCutvPz1cX5ch/W7+ga5grla4Mm+6dztIe6itRDtlTw0kGACCwikaTYf5VhlvJNo79vATe5eby3F88= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858921; 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=aWD/Qk3szSfEZBTtbpcC8O4b8u+9LVoa4Hx6fikLkdc=; b=ReKLI9hIiiL7U0E1S8KzRpvYWt30uvu/bfgO8+MhL1LKfeoFskweAWvvtdeCKUO8ay1pZU2veiY7KJMjYBAiKwxWkVFHl7VE8y7XGZF6V3yXfV3wRds3F6kK0e2CuxymYqXBd/UZ34wi9IcDvwPW9Yex9zoYoN4hLO2Qd++OJRg= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858921014913.8041928038399; Thu, 16 May 2024 04:28:41 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723177.1127792 (Exim 4.92) (envelope-from ) id 1s7ZHe-0006uk-FW; Thu, 16 May 2024 11:28:26 +0000 Received: by outflank-mailman (output) from mailman id 723177.1127792; Thu, 16 May 2024 11:28:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHe-0006sK-9r; Thu, 16 May 2024 11:28:26 +0000 Received: by outflank-mailman (input) for mailman id 723177; Thu, 16 May 2024 11:28:25 +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 1s7ZHd-0006b7-4l for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:25 +0000 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [2a00:1450:4864:20::131]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 67cd5efb-1377-11ef-b4bb-af5377834399; Thu, 16 May 2024 13:28:23 +0200 (CEST) Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-520f9d559f6so807061e87.3 for ; Thu, 16 May 2024 04:28:23 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:22 -0700 (PDT) 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: 67cd5efb-1377-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858903; x=1716463703; 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=aWD/Qk3szSfEZBTtbpcC8O4b8u+9LVoa4Hx6fikLkdc=; b=OAKSN4zl9kKwGdQLBWRMJB9b9kfhMWeWGWoJrYXfQM+7bjt7OFLUMfEUABYRlzXOQF uDcSzUfzdIftid9NaWRFtI/jIu5fo92rQTSKgAm6zNZZJFElvyHG6K+haJeA2qWYfMNn DziNiECtOOiSCg7gTrlAxuM11+0YgzshHr59pfwctJXT+CgRqMU/3XnFWNyr2xh9SLCJ msc7tbERB3uEuWibBMOj3btwV2rSj+auk/wnflHUaLB0YPw8QK0LvITfuyuF2QkJk7hZ kX68SrgkCJ/AW35T5jP101ll9Cm9j7hGlHTH78zzpcEyiQ9gf9Vnwy4UQjvz2AI/eHWy Pbcw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858903; x=1716463703; 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=aWD/Qk3szSfEZBTtbpcC8O4b8u+9LVoa4Hx6fikLkdc=; b=br+nRm8I9SQeMESpNj6hx98KYeURRn289JV/DbHENoXBokbSlA/dP+DHslRJx1wFZz 3pCVNJYv9bwBljyjTQ0GCKwEBGOSkqTES7AtAAg53Xl1876gWTP5xxoskxHQoB3JgoV+ WGgZFZ1OX7YOEpix5l/Wnu8KQrmXSPeZ/UNV6s0tKprnji8YHFk6RjeOw8M+rWISHcU3 Azh9a2NYPJmTGQpZoaec03vedKqyXbcv+jdXdolkE5UKGBuajRhn29W1a8pFBgR0NhDF SPFtOGjEoGPhr6y50lIgRsyJ1Lhj0PlIvGYy8IsvbGVIbTm3LpsyxaOBY+bEySwBbBty 1WNw== X-Gm-Message-State: AOJu0Yy8+R0ZOx5iS+OypjZ9pjEbfZhq46coi/qnTAlrGGUNMcuDJx6G PXolxTeALjH4+uNb4RWUITGBKvB9qHD57y991IXvVUs3yL08x6AFAVMNX63g X-Google-Smtp-Source: AGHT+IGL1s/Lp2LGNzl8vhiI2q4MxCc8OCCAMNjP6bbLOuclhZG+4EypeAZqby+BnX5zKsvL2FiZvg== X-Received: by 2002:ac2:5b1e:0:b0:519:1047:7eac with SMTP id 2adb3069b0e04-5220fb746edmr12699563e87.23.1715858902834; Thu, 16 May 2024 04:28:22 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , George Dunlap , Nick Rosbrook , Anthony PERARD , Juergen Gross Subject: [PATCH for-4.19? v3 2/6] tools/xl: Add altp2m_count parameter Date: Thu, 16 May 2024 11:28:09 +0000 Message-Id: <71133f351e0a5d6b993c608e8d33e62487d6142c.1715858136.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858921231100002 From: Petr Bene=C5=A1 Introduce a new altp2m_count parameter to control the maximum number of alt= p2m views a domain can use. By default, if altp2m_count is unspecified and altp= 2m is enabled, the value is set to 10, reflecting the legacy behavior. This change is preparatory; it establishes the groundwork for the feature b= ut does not activate it. Signed-off-by: Petr Bene=C5=A1 --- tools/golang/xenlight/helpers.gen.go | 2 ++ tools/golang/xenlight/types.gen.go | 1 + tools/include/libxl.h | 8 ++++++++ tools/libs/light/libxl_create.c | 9 +++++++++ tools/libs/light/libxl_types.idl | 1 + tools/xl/xl_parse.c | 4 ++++ 6 files changed, 25 insertions(+) diff --git a/tools/golang/xenlight/helpers.gen.go b/tools/golang/xenlight/h= elpers.gen.go index 78bdb08b15..40c247a0d0 100644 --- a/tools/golang/xenlight/helpers.gen.go +++ b/tools/golang/xenlight/helpers.gen.go @@ -1158,6 +1158,7 @@ if err :=3D x.ArchX86.MsrRelaxed.fromC(&xc.arch_x86.m= sr_relaxed);err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } x.Altp2M =3D Altp2MMode(xc.altp2m) +x.Altp2MCount =3D uint32(xc.altp2m_count) x.VmtraceBufKb =3D int(xc.vmtrace_buf_kb) if err :=3D x.Vpmu.fromC(&xc.vpmu);err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) @@ -1674,6 +1675,7 @@ if err :=3D x.ArchX86.MsrRelaxed.toC(&xc.arch_x86.msr= _relaxed); err !=3D nil { return fmt.Errorf("converting field ArchX86.MsrRelaxed: %v", err) } xc.altp2m =3D C.libxl_altp2m_mode(x.Altp2M) +xc.altp2m_count =3D C.uint32_t(x.Altp2MCount) xc.vmtrace_buf_kb =3D C.int(x.VmtraceBufKb) if err :=3D x.Vpmu.toC(&xc.vpmu); err !=3D nil { return fmt.Errorf("converting field Vpmu: %v", err) diff --git a/tools/golang/xenlight/types.gen.go b/tools/golang/xenlight/typ= es.gen.go index ccfe18019e..a3ae8ef35a 100644 --- a/tools/golang/xenlight/types.gen.go +++ b/tools/golang/xenlight/types.gen.go @@ -602,6 +602,7 @@ ArchX86 struct { MsrRelaxed Defbool } Altp2M Altp2MMode +Altp2MCount uint32 VmtraceBufKb int Vpmu Defbool } diff --git a/tools/include/libxl.h b/tools/include/libxl.h index 62cb07dea6..1f149a8015 100644 --- a/tools/include/libxl.h +++ b/tools/include/libxl.h @@ -1239,6 +1239,14 @@ typedef struct libxl__ctx libxl_ctx; */ #define LIBXL_HAVE_ALTP2M 1 +/* + * LIBXL_HAVE_ALTP2M_COUNT + * If this is defined, then libxl supports setting the maximum number of + * alternate p2m tables. + */ +#define LIBXL_HAVE_ALTP2M_COUNT 1 +#define LIBXL_ALTP2M_COUNT_DEFAULT (~(uint32_t)0) + /* * LIBXL_HAVE_REMUS * If this is defined, then libxl supports remus. diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index 41252ec553..236b8c1965 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -483,6 +483,15 @@ int libxl__domain_build_info_setdefault(libxl__gc *gc, return -ERROR_INVAL; } + if (b_info->altp2m_count =3D=3D LIBXL_ALTP2M_COUNT_DEFAULT) { + if ((libxl_defbool_val(b_info->u.hvm.altp2m) || + b_info->altp2m !=3D LIBXL_ALTP2M_MODE_DISABLED)) + /* Reflect the default legacy count */ + b_info->altp2m_count =3D 10; + else + b_info->altp2m_count =3D 0; + } + /* Assume that providing a bootloader user implies enabling restrict. = */ libxl_defbool_setdefault(&b_info->bootloader_restrict, !!b_info->bootloader_user); diff --git a/tools/libs/light/libxl_types.idl b/tools/libs/light/libxl_type= s.idl index 79e9c656cc..eb306fedf5 100644 --- a/tools/libs/light/libxl_types.idl +++ b/tools/libs/light/libxl_types.idl @@ -728,6 +728,7 @@ libxl_domain_build_info =3D Struct("domain_build_info",[ # Alternate p2m is not bound to any architecture or guest type, as it = is # supported by x86 HVM and ARM support is planned. ("altp2m", libxl_altp2m_mode), + ("altp2m_count", uint32, {'init_val': 'LIBXL_ALTP2M_COUNT_DEFAULT'}), # Size of preallocated vmtrace trace buffers (in KBYTES). # Use zero value to disable this feature. diff --git a/tools/xl/xl_parse.c b/tools/xl/xl_parse.c index c504ab3711..048ab6be0d 100644 --- a/tools/xl/xl_parse.c +++ b/tools/xl/xl_parse.c @@ -2063,6 +2063,10 @@ void parse_config_data(const char *config_source, } } + if (!xlu_cfg_get_long(config, "altp2m_count", &l, 1)) { + b_info->altp2m_count =3D l; + } + if (!xlu_cfg_get_long(config, "vmtrace_buf_kb", &l, 1) && l) { b_info->vmtrace_buf_kb =3D l; } -- 2.34.1 From nobody Fri Nov 22 13:43:19 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858920; cv=none; d=zohomail.com; s=zohoarc; b=BgwvXY72oQmwSWmEXfRrv3OFphW2iiy6+lkIRNwK0sOabMsxW7wdsJT7+7RnI+tK9IsBylo2xT5i4WZv3IefbDeyc+FJ7fQssfzIIN+kRxdZNd9yyIP2dSrM/WgSN4Yvqj9pAYF/WbMav04hozjzvGeld66bzToV8MBuLrX7pAM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858920; 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=BlMJnuVPgAuWx5mzHbOSNLc3FPf2ltoLWAdUx3vSNgk=; b=bVNzelw28mgRrf9CuRcX5xCkrwicVumif2u/iejwXTuhzpY81QhFWQF/2H4fkkXGnPhW6tk11a/e8IE14ZJVN83BcIOkZ4USjlR5F9w1IqF+zcFgjwidVE3fQV8EbzrnC3gy34myNoaV/DdV6c5cxpfl4lCLVI481ZxwRlld6cc= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858920336627.1359134694577; Thu, 16 May 2024 04:28:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723178.1127799 (Exim 4.92) (envelope-from ) id 1s7ZHe-00071r-TH; Thu, 16 May 2024 11:28:26 +0000 Received: by outflank-mailman (output) from mailman id 723178.1127799; Thu, 16 May 2024 11:28:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHe-0006z4-KF; Thu, 16 May 2024 11:28:26 +0000 Received: by outflank-mailman (input) for mailman id 723178; Thu, 16 May 2024 11:28:25 +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 1s7ZHd-0006b7-QU for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:25 +0000 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [2a00:1450:4864:20::532]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 68341d63-1377-11ef-b4bb-af5377834399; Thu, 16 May 2024 13:28:24 +0200 (CEST) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-5731ffcc905so3612976a12.2 for ; Thu, 16 May 2024 04:28:24 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:23 -0700 (PDT) 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: 68341d63-1377-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858903; x=1716463703; 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=BlMJnuVPgAuWx5mzHbOSNLc3FPf2ltoLWAdUx3vSNgk=; b=gzVMOmwwqbE8u6F1Alm2kSXpRqxOTycAxF0lf0ewQX3WoV8k0MdCdBpmzf4axl8csN dn4hTFR97WvSpiqI1Hjs++H/y+e+tCchefjZsqSMKR4MZK+DaWlRjvP36e9h9u0SnrEg eFrWiADKTh++V7CeFaFap4Vglk/LBLMceyqiLUUmM1ozFGogeKqy8BjjmmL3li16kfbL RsDaC31zL8Swpw+c850H+TaYJ/9wnGUDCKpbPtDzH+JVc/3ODYSraicWJFLNFdf/ZcgZ GiO6pwDigqbuNnLZQqkJ9UNrbgl86Jv6FC0XeyAdTqPO1WLBnuBfvsw4J61VBzUHS+yU hJ0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858903; x=1716463703; 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=BlMJnuVPgAuWx5mzHbOSNLc3FPf2ltoLWAdUx3vSNgk=; b=GWGEllRKoEOdN/FQ1LNzwEc5VRplE+fr1EYXCCfPnU31ybS4njQw1quJAjrccQ/MnY KlH5TF5fkBIIcONLHnOHiWh2eA65YeeqaOZ6Vv9iX8d1eon2QkJSvFQ91thZNO8UJdfN ltnV1kdOjo9xq16rwvhSKH1MQUzr7uiWO1ZzASEZzC7Q6vjTzO5/eRwiIrYQt81q/kNb s+p1AZvRBK4KtV/+S2GvD6mRgUK7sn2ozcgiyTyAT0/IReLvUdcp8VsBKiUdE/5dr7SN dWLmVoWe52pdcjLOJjhu1n60iUHh6AHmwHHP2wo2bK4B3MlqgqvQ6txZxy+unMHcugPr NMgg== X-Gm-Message-State: AOJu0YxMDP5GFSx3QiGwKdX5MZVOBkd9u3WP0/o542qe0CY5DmKuJe36 7C0k3vHnsAlkU+QoFFVNEWXERjxsLyxFSOIMD967FsycK/DkK704yz0LGw== X-Google-Smtp-Source: AGHT+IF0k5pWTfdbbFTMbNHJJ4YGIIz1Hmc94hXY1We+20u83JMGUYKVzWzEzNTo2L/vf/NhpK+Sgg== X-Received: by 2002:a50:ccdd:0:b0:574:eb22:3629 with SMTP id 4fb4d7f45d1cf-574eb223677mr4705030a12.19.1715858903583; Thu, 16 May 2024 04:28:23 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD Subject: [PATCH for-4.19? v3 3/6] docs/man: Add altp2m_count parameter to the xl.cfg manual Date: Thu, 16 May 2024 11:28:10 +0000 Message-Id: <12aced8fdd0f2f8e0d1298895393edb8f741d641.1715858136.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858921210100001 From: Petr Bene=C5=A1 Update manual pages to include detailed information about the altp2m_count configuration parameter. Signed-off-by: Petr Bene=C5=A1 --- docs/man/xl.cfg.5.pod.in | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docs/man/xl.cfg.5.pod.in b/docs/man/xl.cfg.5.pod.in index 8f2b375ce9..5c09610cf4 100644 --- a/docs/man/xl.cfg.5.pod.in +++ b/docs/man/xl.cfg.5.pod.in @@ -2039,6 +2039,20 @@ a single guest HVM domain. B: While the option "altp2mhvm" is deprecated, legacy applications f= or x86 systems will continue to work using it. +=3Ditem B + +Specifies the maximum number of alternate-p2m views available to the guest. +This setting is crucial in domain introspection scenarios that require +multiple physical-to-machine (p2m) memory mappings to be established +simultaneously. + +Enabling multiple p2m views may increase memory usage. It is advisable to +review and adjust the B setting as necessary to accommodate +the additional memory requirements. + +B: This option is ignored if B is disabled. The default value +is 10. + =3Ditem B Enable or disables guest access to hardware virtualisation features, -- 2.34.1 From nobody Fri Nov 22 13:43:19 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858928; cv=none; d=zohomail.com; s=zohoarc; b=LFU5CuVTT0MRSrUj2pENhzAyOjvMMXP6lGrzqQVuhy8O8QZA2Y5dVCO147bvEmtTgvVEVPJIIsw0McaG7xjC2GDjIP18hTaUWC8amRkg3DwPV22Fm9VJPyoN8VCbEoAtwoF7FJopR1yXPIx/H8MsFZUlR2VtLMlshX21+L9PEeQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858928; 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=iwSyWpfwO+8Pp/PIuWiuZytsATZP0WHIz6nOkOvuXw0=; b=YrUrLplutTDs/GFooP6rrXaAdTvyVr9Q3ZZGOfTXqOd71Awmy0pp9VvodPPjiBC5lhqMDgBuEgx7QHFB6x71Df+TTzCwrdAcSgSB4sXGn0MonNoRq46QM9jY/kAwbC9UB13/MyP597WYPS+JMx3PT5t2kK/vENYMwiel0nBj7g4= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858928685804.8092182197441; Thu, 16 May 2024 04:28:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723179.1127817 (Exim 4.92) (envelope-from ) id 1s7ZHg-0007YX-5Y; Thu, 16 May 2024 11:28:28 +0000 Received: by outflank-mailman (output) from mailman id 723179.1127817; Thu, 16 May 2024 11:28:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHf-0007Wf-Ut; Thu, 16 May 2024 11:28:27 +0000 Received: by outflank-mailman (input) for mailman id 723179; Thu, 16 May 2024 11:28:27 +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 1s7ZHf-0006b6-65 for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:27 +0000 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [2a00:1450:4864:20::633]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 69306036-1377-11ef-909d-e314d9c70b13; Thu, 16 May 2024 13:28:26 +0200 (CEST) Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-a5a0013d551so163905766b.2 for ; Thu, 16 May 2024 04:28:25 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:24 -0700 (PDT) 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: 69306036-1377-11ef-909d-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858905; x=1716463705; 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=iwSyWpfwO+8Pp/PIuWiuZytsATZP0WHIz6nOkOvuXw0=; b=SuKNqkuXZTyq0Ytp4vwfYKZtYacJ4esIyj7DcJT06Dc1qJvAHl8cnJ3CGJV2tlt2Mi o6hQox7g8TdrDvvhO29fKKiEvO8sMGGsVhyvLmnezXQoXO+Eahze2CSGuoO7PwSNvNzt huoti5yjdKaVWjdS+9PK/7HZPOZzBSg5RKNlPd+utsSsuSBZ2vMbbKPcq1AL1GRBwPBW NRi/phnkCG36oV+uvLfsM9z+5UudkkXR5pQjTEz56OySuZOQENYga8c3IbqsCHOwz47g PQvQApPUz2RnSh6f1oZYLTmYubKbD3Up5Zk4I3hlox4Pn4z2S48vXuESMzIG8Re3IWCQ HqwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858905; x=1716463705; 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=iwSyWpfwO+8Pp/PIuWiuZytsATZP0WHIz6nOkOvuXw0=; b=xGzsTEUShujKnNwi685L6tKgg3xOIiDH3OJpxzDqzxvWmrJd7ViVKaKLFT+Dj7Ad7x 3vx42g0vViICYUDZQrzCcZROjosMaT5dkG8Re9pFtmIpxYm5NmdGNsngs41VN9SZZndG 93Z+7P/UrlrPXWaxhhEBv+ZtGoa4fkIcgiTbxKcGAPe/vra3Ry3N9mcupo1LTrDo6rt6 rkPGMCG5FHtKsH1UFMAbeQHM5OVt/PE7u2kT3BWZhcHiuIfiQxAZFAJCdYIyeIM+/jJN kIRbA2fRCZdsy7KJNPn3C1G0OzL2aJ2WeDxK8QpHofk/6jiYTSj5n4QqTaIWDG+lyJYt a2iQ== X-Gm-Message-State: AOJu0YyHjimPGP7eT6xYNaWmvSeipCXj1mBYq3MJIL/nwbkds0nUBt8m 7fSeKFc+UxKvFe8LzmJjxbA3J5BtHnQVkhjnC3sLD95z5hVsaHq3OYoNnSqH X-Google-Smtp-Source: AGHT+IFeOFO64ZLbiZ4i/uTkzx634CIh9FArxl5qsmEwaJ0WEcvuPBin44FpZpdKvWhzkF38fATy5Q== X-Received: by 2002:aa7:c35a:0:b0:574:b106:57db with SMTP id 4fb4d7f45d1cf-574b1065a14mr13248546a12.21.1715858904921; Thu, 16 May 2024 04:28:24 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Jan Beulich , Andrew Cooper , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , George Dunlap , Julien Grall , Stefano Stabellini , Tamas K Lengyel , Alexandru Isaila , Petre Pircalabu Subject: [PATCH for-4.19? v3 4/6] x86: Make the maximum number of altp2m views configurable Date: Thu, 16 May 2024 11:28:11 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858929307100004 From: Petr Bene=C5=A1 This commit introduces the ability to configure the maximum number of altp2m views for the domain during its creation. Previously, the limits were hardc= oded to a maximum of 10. This change allows for greater flexibility in environme= nts that require more or fewer altp2m views. The maximum configurable limit for max_altp2m on x86 is now set to MAX_EPTP (512). This cap is linked to the architectural limit of the EPTP-switching VMFUNC, which supports up to 512 entries. Despite there being no inherent n= eed for limiting max_altp2m in scenarios not utilizing VMFUNC, decoupling these components would necessitate substantial code changes. Signed-off-by: Petr Bene=C5=A1 --- xen/arch/x86/domain.c | 12 +++++ xen/arch/x86/hvm/hvm.c | 8 +++- xen/arch/x86/hvm/vmx/vmx.c | 2 +- xen/arch/x86/include/asm/domain.h | 7 ++- xen/arch/x86/include/asm/p2m.h | 4 +- xen/arch/x86/mm/altp2m.c | 23 +++++++++- xen/arch/x86/mm/hap/hap.c | 6 +-- xen/arch/x86/mm/mem_access.c | 23 ++++------ xen/arch/x86/mm/mem_sharing.c | 2 +- xen/arch/x86/mm/p2m-ept.c | 10 ++-- xen/arch/x86/mm/p2m.c | 76 +++++++++++++++---------------- xen/common/domain.c | 1 + xen/include/public/domctl.h | 5 +- xen/include/xen/sched.h | 2 + 14 files changed, 108 insertions(+), 73 deletions(-) diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 00a3aaa576..3bd18cb2d0 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -685,6 +685,18 @@ int arch_sanitise_domain_config(struct xen_domctl_crea= tedomain *config) return -EINVAL; } + if ( config->nr_altp2m && !hvm_altp2m_supported() ) + { + dprintk(XENLOG_INFO, "altp2m requested but not available\n"); + return -EINVAL; + } + + if ( config->nr_altp2m > MAX_EPTP ) + { + dprintk(XENLOG_INFO, "nr_altp2m must be <=3D %lu\n", MAX_EPTP); + return -EINVAL; + } + if ( config->vmtrace_size ) { unsigned int size =3D config->vmtrace_size; diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 9594e0a5c5..77e4016bdb 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -4639,6 +4639,12 @@ static int do_altp2m_op( goto out; } + if ( d->nr_altp2m =3D=3D 0 ) + { + rc =3D -EINVAL; + goto out; + } + if ( (rc =3D xsm_hvm_altp2mhvm_op(XSM_OTHER, d, mode, a.cmd)) ) goto out; @@ -5228,7 +5234,7 @@ void hvm_fast_singlestep(struct vcpu *v, uint16_t p2m= idx) if ( !hvm_is_singlestep_supported() ) return; - if ( p2midx >=3D MAX_ALTP2M ) + if ( p2midx >=3D v->domain->nr_altp2m ) return; v->arch.hvm.single_step =3D true; diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 5f67a48592..76ee09b701 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -4888,7 +4888,7 @@ bool asmlinkage vmx_vmenter_helper(const struct cpu_u= ser_regs *regs) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; ++i ) + for ( i =3D 0; i < currd->nr_altp2m; ++i ) { if ( currd->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/include/asm/domain.h b/xen/arch/x86/include/asm/d= omain.h index f5daeb182b..3935328781 100644 --- a/xen/arch/x86/include/asm/domain.h +++ b/xen/arch/x86/include/asm/domain.h @@ -258,11 +258,10 @@ struct paging_vcpu { struct shadow_vcpu shadow; }; -#define MAX_NESTEDP2M 10 - -#define MAX_ALTP2M 10 /* arbitrary */ #define INVALID_ALTP2M 0xffff #define MAX_EPTP (PAGE_SIZE / sizeof(uint64_t)) +#define MAX_NESTEDP2M 10 + struct p2m_domain; struct time_scale { int shift; @@ -353,7 +352,7 @@ struct arch_domain /* altp2m: allow multiple copies of host p2m */ bool altp2m_active; - struct p2m_domain *altp2m_p2m[MAX_ALTP2M]; + struct p2m_domain **altp2m_p2m; mm_lock_t altp2m_list_lock; uint64_t *altp2m_eptp; uint64_t *altp2m_visible_eptp; diff --git a/xen/arch/x86/include/asm/p2m.h b/xen/arch/x86/include/asm/p2m.h index 111badf89a..6faa105baf 100644 --- a/xen/arch/x86/include/asm/p2m.h +++ b/xen/arch/x86/include/asm/p2m.h @@ -881,7 +881,7 @@ static inline struct p2m_domain *p2m_get_altp2m(struct = vcpu *v) if ( index =3D=3D INVALID_ALTP2M ) return NULL; - BUG_ON(index >=3D MAX_ALTP2M); + BUG_ON(index >=3D v->domain->nr_altp2m); return v->domain->arch.altp2m_p2m[index]; } @@ -891,7 +891,7 @@ static inline bool p2m_set_altp2m(struct vcpu *v, unsig= ned int idx) { struct p2m_domain *orig; - BUG_ON(idx >=3D MAX_ALTP2M); + BUG_ON(idx >=3D v->domain->nr_altp2m); if ( idx =3D=3D vcpu_altp2m(v).p2midx ) return false; diff --git a/xen/arch/x86/mm/altp2m.c b/xen/arch/x86/mm/altp2m.c index a04297b646..98dbb50d47 100644 --- a/xen/arch/x86/mm/altp2m.c +++ b/xen/arch/x86/mm/altp2m.c @@ -13,6 +13,11 @@ void altp2m_vcpu_initialise(struct vcpu *v) { + struct domain *d =3D v->domain; + + if ( d->nr_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); @@ -28,8 +33,12 @@ altp2m_vcpu_initialise(struct vcpu *v) void altp2m_vcpu_destroy(struct vcpu *v) { + struct domain *d =3D v->domain; struct p2m_domain *p2m; + if ( d->nr_altp2m =3D=3D 0 ) + return; + if ( v !=3D current ) vcpu_pause(v); @@ -120,7 +129,12 @@ int p2m_init_altp2m(struct domain *d) struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); mm_lock_init(&d->arch.altp2m_list_lock); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + d->arch.altp2m_p2m =3D xzalloc_array(struct p2m_domain *, d->nr_altp2m= ); + + if ( !d->arch.altp2m_p2m ) + return -ENOMEM; + + for ( i =3D 0; i < d->nr_altp2m; i++ ) { d->arch.altp2m_p2m[i] =3D p2m =3D p2m_init_one(d); if ( p2m =3D=3D NULL ) @@ -141,7 +155,10 @@ void p2m_teardown_altp2m(struct domain *d) unsigned int i; struct p2m_domain *p2m; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + if ( !d->arch.altp2m_p2m ) + return; + + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( !d->arch.altp2m_p2m[i] ) continue; @@ -149,6 +166,8 @@ void p2m_teardown_altp2m(struct domain *d) d->arch.altp2m_p2m[i] =3D NULL; p2m_free_one(p2m); } + + XFREE(d->arch.altp2m_p2m); } /* diff --git a/xen/arch/x86/mm/hap/hap.c b/xen/arch/x86/mm/hap/hap.c index d2011fde24..501fd9848b 100644 --- a/xen/arch/x86/mm/hap/hap.c +++ b/xen/arch/x86/mm/hap/hap.c @@ -515,7 +515,7 @@ int hap_enable(struct domain *d, u32 mode) d->arch.altp2m_visible_eptp[i] =3D mfn_x(INVALID_MFN); } - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { rv =3D p2m_alloc_table(d->arch.altp2m_p2m[i]); if ( rv !=3D 0 ) @@ -538,7 +538,7 @@ void hap_final_teardown(struct domain *d) unsigned int i; if ( hvm_altp2m_supported() ) - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) p2m_teardown(d->arch.altp2m_p2m[i], true, NULL); /* Destroy nestedp2m's first */ @@ -590,7 +590,7 @@ void hap_teardown(struct domain *d, bool *preempted) FREE_XENHEAP_PAGE(d->arch.altp2m_eptp); FREE_XENHEAP_PAGE(d->arch.altp2m_visible_eptp); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_teardown(d->arch.altp2m_p2m[i], false, preempted); if ( preempted && *preempted ) diff --git a/xen/arch/x86/mm/mem_access.c b/xen/arch/x86/mm/mem_access.c index 60a0cce68a..015b93447a 100644 --- a/xen/arch/x86/mm/mem_access.c +++ b/xen/arch/x86/mm/mem_access.c @@ -347,12 +347,11 @@ long p2m_set_mem_access(struct domain *d, gfn_t gfn, = uint32_t nr, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( altp2m_idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[altp2m_idx] =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[altp2m_idx]; } if ( !xenmem_access_to_p2m_access(p2m, access, &a) ) @@ -403,12 +402,11 @@ long p2m_set_mem_access_multi(struct domain *d, /* altp2m view 0 is treated as the hostp2m */ if ( altp2m_idx ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( altp2m_idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[altp2m_idx] =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + ap2m =3D d->arch.altp2m_p2m[altp2m_idx]; } p2m_lock(p2m); @@ -466,12 +464,11 @@ int p2m_get_mem_access(struct domain *d, gfn_t gfn, x= enmem_access_t *access, } else if ( altp2m_idx ) /* altp2m view 0 is treated as the hostp2m */ { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( altp2m_idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[altp2m_idx] =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; - p2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_idx); + p2m =3D d->arch.altp2m_p2m[altp2m_idx]; } return _p2m_get_mem_access(p2m, gfn, access); @@ -486,7 +483,7 @@ void arch_p2m_set_access_required(struct domain *d, boo= l access_required) if ( altp2m_active(d) ) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m =3D d->arch.altp2m_p2m[i]; diff --git a/xen/arch/x86/mm/mem_sharing.c b/xen/arch/x86/mm/mem_sharing.c index da28266ef0..83bb9dd5df 100644 --- a/xen/arch/x86/mm/mem_sharing.c +++ b/xen/arch/x86/mm/mem_sharing.c @@ -912,7 +912,7 @@ static int nominate_page(struct domain *d, gfn_t gfn, altp2m_list_lock(d); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { ap2m =3D d->arch.altp2m_p2m[i]; if ( !ap2m ) diff --git a/xen/arch/x86/mm/p2m-ept.c b/xen/arch/x86/mm/p2m-ept.c index f83610cb8c..90b50a0fcf 100644 --- a/xen/arch/x86/mm/p2m-ept.c +++ b/xen/arch/x86/mm/p2m-ept.c @@ -1293,7 +1293,7 @@ static void ept_set_ad_sync(struct domain *d, bool va= lue) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { struct p2m_domain *p2m; @@ -1500,15 +1500,15 @@ void setup_ept_dump(void) void p2m_init_altp2m_ept(struct domain *d, unsigned int i) { - struct p2m_domain *p2m =3D array_access_nospec(d->arch.altp2m_p2m, i); + struct p2m_domain *p2m =3D d->arch.altp2m_p2m[i]; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); struct ept_data *ept; p2m->ept.ad =3D hostp2m->ept.ad; ept =3D &p2m->ept; ept->mfn =3D pagetable_get_pfn(p2m_get_pagetable(p2m)); - d->arch.altp2m_eptp[array_index_nospec(i, MAX_EPTP)] =3D ept->eptp; - d->arch.altp2m_visible_eptp[array_index_nospec(i, MAX_EPTP)] =3D ept->= eptp; + d->arch.altp2m_eptp[i] =3D ept->eptp; + d->arch.altp2m_visible_eptp[i] =3D ept->eptp; } unsigned int p2m_find_altp2m_by_eptp(struct domain *d, uint64_t eptp) @@ -1519,7 +1519,7 @@ unsigned int p2m_find_altp2m_by_eptp(struct domain *d= , uint64_t eptp) altp2m_list_lock(d); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) continue; diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index eb7996170d..a178645c69 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -105,7 +105,7 @@ void p2m_change_entry_type_global(struct domain *d, { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -140,7 +140,7 @@ void p2m_memory_type_changed(struct domain *d) { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -913,7 +913,7 @@ void p2m_change_type_range(struct domain *d, { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -986,7 +986,7 @@ int p2m_finish_type_change(struct domain *d, { unsigned int i; - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) { @@ -1780,7 +1780,7 @@ bool p2m_switch_vcpu_altp2m_by_id(struct vcpu *v, uns= igned int idx) struct domain *d =3D v->domain; bool rc =3D false; - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->nr_altp2m ) return rc; altp2m_list_lock(d); @@ -1886,8 +1886,8 @@ static void p2m_reset_altp2m(struct domain *d, unsign= ed int idx, { struct p2m_domain *p2m; - ASSERT(idx < MAX_ALTP2M); - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ASSERT(idx < d->nr_altp2m); + p2m =3D d->arch.altp2m_p2m[idx]; p2m_lock(p2m); @@ -1912,7 +1912,7 @@ void p2m_flush_altp2m(struct domain *d) altp2m_list_lock(d); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_reset_altp2m(d, i, ALTP2M_DEACTIVATE); d->arch.altp2m_eptp[i] =3D mfn_x(INVALID_MFN); @@ -1928,9 +1928,9 @@ static int p2m_activate_altp2m(struct domain *d, unsi= gned int idx, struct p2m_domain *hostp2m, *p2m; int rc; - ASSERT(idx < MAX_ALTP2M); + ASSERT(idx < d->nr_altp2m); - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[idx]; hostp2m =3D p2m_get_hostp2m(d); p2m_lock(p2m); @@ -1968,12 +1968,12 @@ int p2m_init_altp2m_by_id(struct domain *d, unsigne= d int idx) int rc =3D -EINVAL; struct p2m_domain *hostp2m =3D p2m_get_hostp2m(d); - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( idx >=3D d->nr_altp2m ) return rc; altp2m_list_lock(d); - if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] =3D=3D + if ( d->arch.altp2m_eptp[idx] =3D=3D mfn_x(INVALID_MFN) ) rc =3D p2m_activate_altp2m(d, idx, hostp2m->default_access); @@ -1995,7 +1995,7 @@ int p2m_init_next_altp2m(struct domain *d, uint16_t *= idx, altp2m_list_lock(d); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( d->arch.altp2m_eptp[i] !=3D mfn_x(INVALID_MFN) ) continue; @@ -2017,7 +2017,7 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsign= ed int idx) struct p2m_domain *p2m; int rc =3D -EBUSY; - if ( !idx || idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) ) + if ( !idx || idx >=3D d->nr_altp2m ) return rc; rc =3D domain_pause_except_self(d); @@ -2027,17 +2027,17 @@ int p2m_destroy_altp2m_by_id(struct domain *d, unsi= gned int idx) rc =3D -EBUSY; altp2m_list_lock(d); - if ( d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] !=3D + if ( d->arch.altp2m_eptp[idx] !=3D mfn_x(INVALID_MFN) ) { - p2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + p2m =3D d->arch.altp2m_p2m[idx]; if ( !_atomic_read(p2m->active_vcpus) ) { p2m_reset_altp2m(d, idx, ALTP2M_DEACTIVATE); - d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] =3D + d->arch.altp2m_eptp[idx] =3D mfn_x(INVALID_MFN); - d->arch.altp2m_visible_eptp[array_index_nospec(idx, MAX_EPTP)]= =3D + d->arch.altp2m_visible_eptp[idx] =3D mfn_x(INVALID_MFN); rc =3D 0; } @@ -2055,7 +2055,7 @@ int p2m_switch_domain_altp2m_by_id(struct domain *d, = unsigned int idx) struct vcpu *v; int rc =3D -EINVAL; - if ( idx >=3D MAX_ALTP2M ) + if ( idx >=3D d->nr_altp2m ) return rc; rc =3D domain_pause_except_self(d); @@ -2090,13 +2090,12 @@ int p2m_change_altp2m_gfn(struct domain *d, unsigne= d int idx, mfn_t mfn; int rc =3D -EINVAL; - if ( idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(idx, MAX_EPTP)] =3D=3D - mfn_x(INVALID_MFN) ) + if ( idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[idx] =3D=3D mfn_x(INVALID_MFN) ) return rc; hp2m =3D p2m_get_hostp2m(d); - ap2m =3D array_access_nospec(d->arch.altp2m_p2m, idx); + ap2m =3D d->arch.altp2m_p2m[idx]; p2m_lock(hp2m); p2m_lock(ap2m); @@ -2152,7 +2151,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn= _t gfn, altp2m_list_lock(d); - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { p2m_type_t t; p2m_access_t a; @@ -2175,7 +2174,7 @@ int p2m_altp2m_propagate_change(struct domain *d, gfn= _t gfn, else { /* At least 2 altp2m's impacted, so reset everything */ - for ( i =3D 0; i < MAX_ALTP2M; i++ ) + for ( i =3D 0; i < d->nr_altp2m; i++ ) { if ( i =3D=3D last_reset_idx || d->arch.altp2m_eptp[i] =3D=3D mfn_x(INVALID_MFN) ) @@ -2575,12 +2574,11 @@ int p2m_set_suppress_ve_multi(struct domain *d, if ( sve->view > 0 ) { - if ( sve->view >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) = || - d->arch.altp2m_eptp[array_index_nospec(sve->view, MAX_EPTP)] = =3D=3D - mfn_x(INVALID_MFN) ) + if ( sve->view >=3D d->nr_altp2m || + d->arch.altp2m_eptp[sve->view] =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, sve->view= ); + p2m =3D ap2m =3D d->arch.altp2m_p2m[sve->view]; } p2m_lock(host_p2m); @@ -2643,12 +2641,11 @@ int p2m_get_suppress_ve(struct domain *d, gfn_t gfn= , bool *suppress_ve, if ( altp2m_idx > 0 ) { - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP)= || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]= =3D=3D - mfn_x(INVALID_MFN) ) + if ( altp2m_idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[altp2m_idx] =3D=3D mfn_x(INVALID_MFN) ) return -EINVAL; - p2m =3D ap2m =3D array_access_nospec(d->arch.altp2m_p2m, altp2m_id= x); + p2m =3D ap2m =3D d->arch.altp2m_p2m[altp2m_idx]; } else p2m =3D host_p2m; @@ -2679,17 +2676,16 @@ int p2m_set_altp2m_view_visibility(struct domain *d= , unsigned int altp2m_idx, /* * Eptp index is correlated with altp2m index and should not exceed - * min(MAX_ALTP2M, MAX_EPTP). + * d->nr_altp2m. */ - if ( altp2m_idx >=3D min(ARRAY_SIZE(d->arch.altp2m_p2m), MAX_EPTP) || - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)] =3D= =3D - mfn_x(INVALID_MFN) ) + if ( altp2m_idx >=3D d->nr_altp2m || + d->arch.altp2m_eptp[altp2m_idx] =3D=3D mfn_x(INVALID_MFN) ) rc =3D -EINVAL; else if ( visible ) - d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPT= P)] =3D - d->arch.altp2m_eptp[array_index_nospec(altp2m_idx, MAX_EPTP)]; + d->arch.altp2m_visible_eptp[altp2m_idx] =3D + d->arch.altp2m_eptp[altp2m_idx]; else - d->arch.altp2m_visible_eptp[array_index_nospec(altp2m_idx, MAX_EPT= P)] =3D + d->arch.altp2m_visible_eptp[altp2m_idx] =3D mfn_x(INVALID_MFN); altp2m_list_unlock(d); diff --git a/xen/common/domain.c b/xen/common/domain.c index 6773f7fb90..a10a70e9d4 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -610,6 +610,7 @@ struct domain *domain_create(domid_t domid, if ( config ) { d->options =3D config->flags; + d->nr_altp2m =3D config->nr_altp2m; d->vmtrace_size =3D config->vmtrace_size; } diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index a33f9ec32b..60a871f123 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -21,7 +21,7 @@ #include "hvm/save.h" #include "memory.h" -#define XEN_DOMCTL_INTERFACE_VERSION 0x00000016 +#define XEN_DOMCTL_INTERFACE_VERSION 0x00000017 /* * NB. xen_domctl.domain is an IN/OUT parameter for this operation. @@ -86,6 +86,9 @@ struct xen_domctl_createdomain { uint32_t grant_opts; + /* Number of altp2ms to allocate. */ + uint32_t nr_altp2m; + /* Per-vCPU buffer size in bytes. 0 to disable. */ uint32_t vmtrace_size; diff --git a/xen/include/xen/sched.h b/xen/include/xen/sched.h index 132b841995..18cc0748a1 100644 --- a/xen/include/xen/sched.h +++ b/xen/include/xen/sched.h @@ -602,6 +602,8 @@ struct domain unsigned int guest_request_sync : 1; } monitor; + unsigned int nr_altp2m; /* Number of altp2m tables */ + unsigned int vmtrace_size; /* Buffer size in bytes, or 0 to disable. */ #ifdef CONFIG_ARGO -- 2.34.1 From nobody Fri Nov 22 13:43:20 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858928; cv=none; d=zohomail.com; s=zohoarc; b=VN5HJDMIGRA3yMpxH0sQLCen7OBHOGvNGTtjvzBKnQhnu8MWfYAdarypz4+BrySZ12lXuSTswJiI9IFWws5Qw+4oDyr1kUfSjjl0Cln6UNkZ/ax4J1OB6UYVpXukmSawVuxNVIV+GTBMPoSVLxYw8pt5dajzojXFRctBTVtjt9U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858928; 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=lcXsJFjS9m5+2bzRAoHvtJjIOqkMU5GtwndPgJCwhX4=; b=KZLgA+R+Fd0673ckwSzSFTKVuT/OyxQUkv5wseQPXB36D+ZNkdsbkGh+GNf3EtFwRZeVqVpG/H5qb8Aup206ypsOnkzffMmhXkSrKNY88yqncNOzTQgtqoaaDbycNMRKgSJ3zKlspUCxMjh7810yepN1Ahwg68QCUQQhmGgGLC8= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858928189790.6609484617086; Thu, 16 May 2024 04:28:48 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723180.1127824 (Exim 4.92) (envelope-from ) id 1s7ZHg-0007jZ-Rj; Thu, 16 May 2024 11:28:28 +0000 Received: by outflank-mailman (output) from mailman id 723180.1127824; Thu, 16 May 2024 11:28:28 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHg-0007is-Lt; Thu, 16 May 2024 11:28:28 +0000 Received: by outflank-mailman (input) for mailman id 723180; Thu, 16 May 2024 11:28:28 +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 1s7ZHg-0006b6-66 for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:28 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 6a2d68c9-1377-11ef-909d-e314d9c70b13; Thu, 16 May 2024 13:28:27 +0200 (CEST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-572669fd9f9so3346789a12.0 for ; Thu, 16 May 2024 04:28:27 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:25 -0700 (PDT) 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: 6a2d68c9-1377-11ef-909d-e314d9c70b13 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858907; x=1716463707; 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=lcXsJFjS9m5+2bzRAoHvtJjIOqkMU5GtwndPgJCwhX4=; b=FWWYWfDreGrMzpIK2IDFXfRKtGx+biIrQU41MFruHink8j+mCoPA43ryt75rnGfhf0 IjAm7qjEoA/27cULb5hD66pkbej8DwvpUxRm65k+b4m9Q+RfDU1CewEW1t/3J7oSQS99 ISk9PN/eg4LgvYFPa0vWxzGL7uzpFKmbOpUUfzMAoSF8Y6O4a3Ri9ajasLERagsr2k1A t303GUQRGPCvgsSHU7YlYHCU9Rz1Bz0oWVEfNuVpK0kYC0H45OUv8HmhA8Twkw3fYT+F jZLg+WYilupzgc/w3EDqyuxTOiiqe516lmYfd+U/giYEssH+6jT1bWLy0ny054faS/ri De6Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858907; x=1716463707; 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=lcXsJFjS9m5+2bzRAoHvtJjIOqkMU5GtwndPgJCwhX4=; b=sDL+yKVUjDM3B7lT67vZ+VRnEft3kyH0pi/oRYMmycWiNu90u0Bez9dNOb3lOcCDcW h/neoZZZyfwM33wLWvB1RhEBr8Rf08AHE/5h1bisVAC47u3l/ovpMciznwL06KWfd3O3 uW5DQg8LTdPLMjT++k/+QMkygmGPpZ6wpjwpBpKw0JrSJPL4Iith2NwcAIWOBCQ6C+PW PhRSl0ZomRpa+UA0BfQEWsWa8R1Hg2ePBjB05LkoqClqzgK9DQ+2N8u2E9Qllp01J1lr PNT1K8PABlh+xlimYk//rf2SW8ue4tBcTs744Rx52cJkdojt70wLf+TQA+wcVe6oO3Fk Y7Eg== X-Gm-Message-State: AOJu0YwrMYVFIf2nXJhDuEomBNfNGHCMXS4eEkwCycAc6IzwCc/Mlyse LA2UqrZQzqv4Uw2CKrhcfMbwa9+5xTZVAEsxUcr6thjE1/OWB0AapbDDUg== X-Google-Smtp-Source: AGHT+IEDNx0Eao0z1ZBy+RPyD3phVLCE34VncoyEhxg5SSGon5U7YHDOnSbpDqNvuzkTzzEeJEbSSw== X-Received: by 2002:a50:8d4e:0:b0:571:bed1:3a27 with SMTP id 4fb4d7f45d1cf-5734d6f2d33mr13268941a12.38.1715858905672; Thu, 16 May 2024 04:28:25 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Anthony PERARD , Juergen Gross Subject: [PATCH for-4.19? v3 5/6] tools/libxl: Activate the altp2m_count feature Date: Thu, 16 May 2024 11:28:12 +0000 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858929258100001 From: Petr Bene=C5=A1 This commit activates the previously introduced altp2m_count parameter, establishing the connection between libxl and Xen. Signed-off-by: Petr Bene=C5=A1 --- tools/libs/light/libxl_create.c | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/libs/light/libxl_create.c b/tools/libs/light/libxl_creat= e.c index 236b8c1965..f5eb16d0dc 100644 --- a/tools/libs/light/libxl_create.c +++ b/tools/libs/light/libxl_create.c @@ -657,6 +657,7 @@ int libxl__domain_make(libxl__gc *gc, libxl_domain_conf= ig *d_config, .max_grant_frames =3D b_info->max_grant_frames, .max_maptrack_frames =3D b_info->max_maptrack_frames, .grant_opts =3D XEN_DOMCTL_GRANT_version(b_info->max_grant_ver= sion), + .nr_altp2m =3D b_info->altp2m_count, .vmtrace_size =3D ROUNDUP(b_info->vmtrace_buf_kb << 10, XC_PAG= E_SHIFT), .cpupool_id =3D info->poolid, }; -- 2.34.1 From nobody Fri Nov 22 13:43:20 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1715858931; cv=none; d=zohomail.com; s=zohoarc; b=JhwagVORtNeFtR6XsnD8cJUjT0CDG8qxvzb3tEhIP7whxf15e77CeKz4XWH8kIkPJZyAN44BaCrrc9lf8BDhyrG7N1Bf3WYCwkZ2hx/5UjlPI/ncQLJytX4HlelU7sCLgRSPgN1MX/BD6xc9QsfWyhPDzZrhNMg3mLN1nPAR9Hc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1715858931; 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=CZx7e4I8f24AmBOZ73vCNLclq5iufdJNqbBIJFjDxwY=; b=EuEVFtqsudXv/z4PJ6xn24DhVl6YxmpuO7UaWPjqJ1LkSRK3eCleCOEFFnCjLR7mu1IPiCv3VVrzVqjjp6oPs21U3WBtioFIRUZU50vUCB4W2YOvq8RHflsP7kjN9K0X4mKFgEtUUisAQI0J7E13rwiXWxm7cg28ezt3ynEgd/s= 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=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1715858931740737.9224809039279; Thu, 16 May 2024 04:28:51 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.723181.1127837 (Exim 4.92) (envelope-from ) id 1s7ZHj-0008BJ-5V; Thu, 16 May 2024 11:28:31 +0000 Received: by outflank-mailman (output) from mailman id 723181.1127837; Thu, 16 May 2024 11:28:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1s7ZHj-0008B7-1q; Thu, 16 May 2024 11:28:31 +0000 Received: by outflank-mailman (input) for mailman id 723181; Thu, 16 May 2024 11:28:29 +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 1s7ZHh-0006b7-LA for xen-devel@lists.xenproject.org; Thu, 16 May 2024 11:28:29 +0000 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [2a00:1450:4864:20::52b]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 6a7b8689-1377-11ef-b4bb-af5377834399; Thu, 16 May 2024 13:28:28 +0200 (CEST) Received: by mail-ed1-x52b.google.com with SMTP id 4fb4d7f45d1cf-572a93890d1so3445325a12.3 for ; Thu, 16 May 2024 04:28:28 -0700 (PDT) Received: from lab.home (dynamic-2a00-1028-83a4-4bca-c0bb-96ff-feed-9d50.ipv6.o2.cz. [2a00:1028:83a4:4bca:c0bb:96ff:feed:9d50]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-574bcede889sm7083043a12.92.2024.05.16.04.28.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 May 2024 04:28:27 -0700 (PDT) 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: 6a7b8689-1377-11ef-b4bb-af5377834399 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715858907; x=1716463707; 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=CZx7e4I8f24AmBOZ73vCNLclq5iufdJNqbBIJFjDxwY=; b=Sc+mGZyYiWezTycnwzIkred2qGbRW+6rpfIGtNqySYtcrSrpBgrs2p/ku0YoqdLwvb Tdx2bJkN6eCAQbnlVkptbdxrpg5YYHIuYQR1OEZeBNScLuqYIZ7ugdRFy4NFjKlMyCoI 4MeRaJy03JgtdJ9Kk/Ol551OB2wyZMEAVqN+zCjn7xmObnitvGXRfLgPyeNmXRJV9JvZ 1vyEj0l4h4geTuhJQkGa1M3lUp+3zX6OZdeeoMIzKQwes6W/+gEzWX+k3IKW9FD2/dv5 sB47X6tLcizzLiNGoVvob1ewIvDg2FQGiEJ5+nECFq3IKqwJwivPkJzN8cf8O+fsBFDM ZrLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715858907; x=1716463707; 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=CZx7e4I8f24AmBOZ73vCNLclq5iufdJNqbBIJFjDxwY=; b=iIJXLTJMcQOloRgan+VZJI+2Ym3hokvgT1WFn8QydS5vW1FoPsuhn9ls+Kx8+zABAU EuEjJEJJsK98zeHwD+qS1VlCbva3YppnvM9sAshy2dVjKEOICONEDc9EqNw0eaB1Ws1N TtXBQEcjVoJ/7WHjJh0yi5+rIGCIMDQfYDgiApKzMTNroR341kjC83J/p+cM7s6ORqEO sVHi8gyBTt6YU7shdG/EuSJSz25j+PfTP7ACzL3Bhu2OjU88UGpRuU/oh3dre9uUhcc4 TGMlFNl25GWctkaAff+9ultl39coGEGyFKgkbwv6rUDw9use0b6LgnbHM7yF43VMwff5 jlmA== X-Gm-Message-State: AOJu0YzLtRB9VNNm1goczEVocIKBoOUkt+Bj8Ci0UDgdyqXhUlGwKajg tE8MkH+o+0D6V2pzxJM4wK8xMd00C2gZkPFMWu+44Y8309gXHpbnCVNB/xOh X-Google-Smtp-Source: AGHT+IF340ISLMPoj07I1Jt9JQ5Xug7pRVHWxjYlGkF/DFVxJW3+Izogh9HGDdXfmKU9eVffMT049g== X-Received: by 2002:a50:bb0f:0:b0:56f:e7b9:e67d with SMTP id 4fb4d7f45d1cf-5734d5cec3bmr19668133a12.12.1715858907443; Thu, 16 May 2024 04:28:27 -0700 (PDT) From: "=?UTF-8?q?Petr=20Bene=C5=A1?=" X-Google-Original-From: =?UTF-8?q?Petr=20Bene=C5=A1?= To: xen-devel@lists.xenproject.org Cc: =?UTF-8?q?Petr=20Bene=C5=A1?= , Christian Lindig , David Scott , Anthony PERARD , Christian Lindig Subject: [PATCH for-4.19? v3 6/6] tools/ocaml: Add altp2m_count parameter Date: Thu, 16 May 2024 11:28:13 +0000 Message-Id: <8537c5deeb409580868ec8d88171146dc7138662.1715858136.git.w1benny@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @gmail.com) X-ZM-MESSAGEID: 1715858933231100001 From: Petr Bene=C5=A1 Allow developers using the OCaml bindings to set the altp2m_count parameter. Signed-off-by: Petr Bene=C5=A1 Acked-by: Christian Lindig --- tools/ocaml/libs/xc/xenctrl.ml | 1 + tools/ocaml/libs/xc/xenctrl.mli | 1 + tools/ocaml/libs/xc/xenctrl_stubs.c | 11 +++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tools/ocaml/libs/xc/xenctrl.ml b/tools/ocaml/libs/xc/xenctrl.ml index 55923857ec..dfb3d331c9 100644 --- a/tools/ocaml/libs/xc/xenctrl.ml +++ b/tools/ocaml/libs/xc/xenctrl.ml @@ -85,6 +85,7 @@ type domctl_create_config =3D max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; + altp2m_count: int; vmtrace_buf_kb: int32; cpupool_id: int32; arch: arch_domainconfig; diff --git a/tools/ocaml/libs/xc/xenctrl.mli b/tools/ocaml/libs/xc/xenctrl.= mli index 9b4b45db3a..ff0e309c56 100644 --- a/tools/ocaml/libs/xc/xenctrl.mli +++ b/tools/ocaml/libs/xc/xenctrl.mli @@ -77,6 +77,7 @@ type domctl_create_config =3D { max_grant_frames: int; max_maptrack_frames: int; max_grant_version: int; + altp2m_count: int; vmtrace_buf_kb: int32; cpupool_id: int32; arch: arch_domainconfig; diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c b/tools/ocaml/libs/xc/xenc= trl_stubs.c index 2b6d3c09df..1f544cd2e4 100644 --- a/tools/ocaml/libs/xc/xenctrl_stubs.c +++ b/tools/ocaml/libs/xc/xenctrl_stubs.c @@ -210,9 +210,10 @@ CAMLprim value stub_xc_domain_create(value xch_val, va= lue wanted_domid, value co #define VAL_MAX_GRANT_FRAMES Field(config, 6) #define VAL_MAX_MAPTRACK_FRAMES Field(config, 7) #define VAL_MAX_GRANT_VERSION Field(config, 8) -#define VAL_VMTRACE_BUF_KB Field(config, 9) -#define VAL_CPUPOOL_ID Field(config, 10) -#define VAL_ARCH Field(config, 11) +#define VAL_ALTP2M_COUNT Field(config, 9) +#define VAL_VMTRACE_BUF_KB Field(config, 10) +#define VAL_CPUPOOL_ID Field(config, 11) +#define VAL_ARCH Field(config, 12) uint32_t domid =3D Int_val(wanted_domid); uint64_t vmtrace_size =3D Int32_val(VAL_VMTRACE_BUF_KB); @@ -230,6 +231,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co .max_maptrack_frames =3D Int_val(VAL_MAX_MAPTRACK_FRAMES), .grant_opts =3D XEN_DOMCTL_GRANT_version(Int_val(VAL_MAX_GRANT_VERSION)), + .nr_altp2m =3D Int_val(VAL_ALTP2M_COUNT), .vmtrace_size =3D vmtrace_size, .cpupool_id =3D Int32_val(VAL_CPUPOOL_ID), }; @@ -257,7 +259,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co #if defined(__i386__) || defined(__x86_64__) /* Quick & dirty check for ABI changes. */ - BUILD_BUG_ON(sizeof(cfg) !=3D 64); + BUILD_BUG_ON(sizeof(cfg) !=3D 68); /* Mnemonics for the named fields inside xen_x86_arch_domainconfig= */ #define VAL_EMUL_FLAGS Field(arch_domconfig, 0) @@ -288,6 +290,7 @@ CAMLprim value stub_xc_domain_create(value xch_val, val= ue wanted_domid, value co #undef VAL_ARCH #undef VAL_CPUPOOL_ID #undef VAL_VMTRACE_BUF_KB +#undef VAL_ALTP2M_COUNT #undef VAL_MAX_GRANT_VERSION #undef VAL_MAX_MAPTRACK_FRAMES #undef VAL_MAX_GRANT_FRAMES -- 2.34.1