From patchwork Sat Feb 3 00:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13543870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7E34FC4828F for ; Sat, 3 Feb 2024 05:33:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=60l8SZDl2tmQIP5k1OTXI1QYqDaVwTPdoQjcqjDedhw=; b=RAFVBcUq9YGiRl W69QQmE1Ye8+Q6u1RcxdP6dJazTUJKePJgT5tJHqGf8JoCLY6sShIecG1N3Afj8LEryEc12HwsnZM p57FDaCI13bFoMl7nkoWPsx8Bc2+hZQJ+I+nxe2f1hjPNj+KJ6U9ah9hPBTqgmLWkjHNAve4p/4wS MxNtFIDmGC9BS01CsG71yUpAw3U1zHt/8JIJVQ6Hd4Gkx7gEoUCm3fYDQ63j7gGFmA7oC9LFJAOas ky5WACV0U6cXkC4xqguB1A3P9hBUX8HxEYRzMy7LMQU63qkD6TgYoG4kPyBRup/3Xew1ZKYIDVwQs wPshwLghKxqSKAFFiYuQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW8ek-0000000FP32-1w69; Sat, 03 Feb 2024 05:33:34 +0000 Received: from mail-pl1-x649.google.com ([2607:f8b0:4864:20::649]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rW3bB-0000000Dsec-3UHS for linux-arm-kernel@lists.infradead.org; Sat, 03 Feb 2024 00:09:43 +0000 Received: by mail-pl1-x649.google.com with SMTP id d9443c01a7336-1d542680c9cso31547875ad.2 for ; Fri, 02 Feb 2024 16:09:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706918973; x=1707523773; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=uGdQAEk26j5OxpYXu3PaMK7EeL8Au0IOP5m2/Y3bZT0=; b=jbKIHrNELs1Stup0gIoJTcgb4oZ5puxaW5v/6aQeVWgm82ib+seW44F+wSqAaNjOGV 8sl00SSzFRz3ehG304DcsihpT9qNgCvm0OfcZ8BxDt8EAUKSrHDnGD/ge9Z2628DO0f9 0YAfn212ydwCqBj+n0HpjjLdGNiDK0lFEsGzB//nLMZLR21ZkjNi1lRL6TKs3TvKIDwe CGfcT8gxQQbLaqXVL7HlC8b8xIYv5XfMwm3D8G7lWY+5Vb7bLMNtxV4RUx2HsZWBrM8T dsQ7lMbV/Pad4CdKRHYp/b+01RqH+39lVe7UXcr+GhwEKt/umdLAyEnElbZuMvDUHNRI aB3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706918973; x=1707523773; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=uGdQAEk26j5OxpYXu3PaMK7EeL8Au0IOP5m2/Y3bZT0=; b=l197GaitHNMMeHVuqUcZk1sBQDlckOok7JiweHRgMtR1hEFRiHQ+RDeImaS4lyFRtj jCQVM52GYA7eq+AYV9vgokd20pSURCFV04CBaB3SCf5DkTcz03ceO2nHjYkK9A4nHROe w+M8JN+S8eijkZNz+Mt415xC1lU2GWSMbH04zTldP+IsgpIGsJ6NXEYDUPTfcLjm06DU 7MQZLvvG0IxNUb9UnYHtOEE0l5CzMNaI1TykK+MpD9txCfuMtWVXCvrntSsNJ/1QuMwd feY2ztoeseURIugtKJMh13/uztj9fbyYU+KGghgQBXhY3O3Kk6YDukVuGYvphLdUoujW aMUw== X-Gm-Message-State: AOJu0YyPPWwygUUitYqz4bM9jwNfewEJYtzbRn797JTwBveKlhME8z89 bvCTSnPuFV1X5NkqzGN4Itp18lraP5WUzNMYKNl1UK2yVUOUU8Pti7Ae0EEXZCTEdlu8hOpeRRg Jsw== X-Google-Smtp-Source: AGHT+IFjC15kDw5iExzgefryGqdvDfKmWm4cQaCALbm/PwXRZkCDFthW43qe2jb3I/GBr57667GkOb1b5Sk= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:902:e80c:b0:1d9:855b:629f with SMTP id u12-20020a170902e80c00b001d9855b629fmr3990plg.11.1706918972726; Fri, 02 Feb 2024 16:09:32 -0800 (PST) Date: Fri, 2 Feb 2024 16:09:12 -0800 In-Reply-To: <20240203000917.376631-1-seanjc@google.com> Mime-Version: 1.0 References: <20240203000917.376631-1-seanjc@google.com> X-Mailer: git-send-email 2.43.0.594.gd9cf4e227d-goog Message-ID: <20240203000917.376631-7-seanjc@google.com> Subject: [PATCH v8 06/10] KVM: selftests: Explicitly ucall pool from shared memory From: Sean Christopherson To: Paolo Bonzini , Marc Zyngier , Oliver Upton , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Sean Christopherson Cc: kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org, Vishal Annapurve , Ackerley Tng , Andrew Jones , Tom Lendacky , Michael Roth , Peter Gonda X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240202_160934_182713_C46756D1 X-CRM114-Status: UNSURE ( 9.36 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Peter Gonda Allocate the common ucall pool using vm_vaddr_alloc_shared() so that the ucall structures will be placed in shared (unencrypted) memory for VMs with support for protected (encrypted) memory, e.g. x86's SEV. Cc: Paolo Bonzini Cc: Sean Christopherson Cc: Vishal Annapurve Cc: Ackerly Tng cc: Andrew Jones Cc: Tom Lendacky Cc: Michael Roth Signed-off-by: Peter Gonda [sean: massage changelog] Signed-off-by: Sean Christopherson --- tools/testing/selftests/kvm/lib/ucall_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/testing/selftests/kvm/lib/ucall_common.c b/tools/testing/selftests/kvm/lib/ucall_common.c index 816a3fa109bf..f5af65a41c29 100644 --- a/tools/testing/selftests/kvm/lib/ucall_common.c +++ b/tools/testing/selftests/kvm/lib/ucall_common.c @@ -29,7 +29,8 @@ void ucall_init(struct kvm_vm *vm, vm_paddr_t mmio_gpa) vm_vaddr_t vaddr; int i; - vaddr = __vm_vaddr_alloc(vm, sizeof(*hdr), KVM_UTIL_MIN_VADDR, MEM_REGION_DATA); + vaddr = vm_vaddr_alloc_shared(vm, sizeof(*hdr), KVM_UTIL_MIN_VADDR, + MEM_REGION_DATA); hdr = (struct ucall_header *)addr_gva2hva(vm, vaddr); memset(hdr, 0, sizeof(*hdr));