Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp552347lqt; Mon, 18 Mar 2024 16:37:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV06NUAhWsIeOFqekQVfM+FzBijrDR2iYStl69jbMeiwFb+A5qDd6Et54dPuWU5bPDDKCJRyEFGPyH8N1WUCI2KJqilk8pbPxbSSLfP5w== X-Google-Smtp-Source: AGHT+IGGBohaNznoc+x/k5YUjCAVM5p/sEHiMfYZosjEC26eReG9ka5eAltIuhsPvkqcMux6Yluv X-Received: by 2002:a17:902:c1c5:b0:1de:f031:e732 with SMTP id c5-20020a170902c1c500b001def031e732mr965962plc.59.1710805029126; Mon, 18 Mar 2024 16:37:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710805029; cv=pass; d=google.com; s=arc-20160816; b=uLkZiGzBC62/ksAcnC0vv7JRy/P1TJdBfi8eclnbc1g3xXlCTHCif/w/q+oaJ8ykPf hz1XeQnYaJ5xF0SLxRWTCd9Ts/Bu3w9jWdpBvCzaiVx8COhTaXwZJJIC7Ojb7xzfZOvf luyuy3VOLD/yPzV4ZuatQeBR1q8uKXKZaDEK9S/tBbLUlIBbol1o8opI02CYTrAvIZGl SYwboZsZXvv3MFaj00Wey9YkqQJLZkEb3YBjAx/BOTPSwTBx9VzYsc6Wwnbt8qd6db6R BV7Z4tUVBNClP/ZW69KdW9mQB2Xme9dBcuJgP+6u7JtbIfUMG/5wlJxTpb3EEMjbLjJR h9uA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Y/UJD6UkjatoT2sa2f7cYALB+Y8wZfv5tBpC6qWKUlU=; fh=3hAI0TnvvweyuafrDQR9sJAViJ87fw+qG0excEgpXGk=; b=rEkZ8RajBtlTWKKlFhkpgszWZbU9MaMlCujhlPRehmnT/5+HYP/1Y/kh2usojWN9o5 rjuviY25v1a+i8jYhQ9b+fPyO39tH0azx3LEB0eJJul3CePeqQ+HUh5Z8U0FNmoRydOR T6JPkyFcxd1We5FP2SJ39//3slviaRvaxsabJM/4ACVxlS/DCe2pwvLThd46D/1vDssi 20rpqYY2qXRbFbn2NFLbmZYSXvf07tPSvW/py6HQqAHYDOwq11Zf2ocBb0+WWfGUOlK3 bWB00vY4mC6YwnBpFubk1PMMAJXsrR2Fy9sKdFGjjqr2kgRLFTgijeHjaXTxQ1bWnvDy 5daw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fHmLjZnz; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e7-20020a170902ef4700b001e0088e64b9si4762270plx.646.2024.03.18.16.37.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 16:37:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=fHmLjZnz; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-106816-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106816-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id CA7D6283C61 for ; Mon, 18 Mar 2024 23:37:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9F9AB60DCD; Mon, 18 Mar 2024 23:34:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="fHmLjZnz" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 310255FDC9 for ; Mon, 18 Mar 2024 23:34:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710804845; cv=none; b=F0I1i5XKgkZGOWFDquALgv+Y/AUId4ByEknANg9bb7wZTKG218hIyckbE+nrmO+EYBirftednKhx3MxrXVRCklqgyBnsly+KJHxGucv70RZLglDyHnl3GP0qzlsMbJvejDzmvyD39arORDyiiA242p6XrRQWdKB+eSpw09+Vzp4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710804845; c=relaxed/simple; bh=X+wpiCLHt0A0MlEox5pBcvd+CZnKQyhur6Qdq10ypmc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=h1MjnSJV9zGkvKBRnQjbZ5E+JnZxoQG+eOrVD5aO6xNTxrWPHaqqqWKIcX4jYqNK0MMZ1nt1RmqXkxV5XAMx9w+W4niSHdhLRlwm3aOVXsQzWVmk8oOQwFVOW9oUj1G3qkUx5vUYZOcB7lP5L3YacaBEBbj8I2H2MUUlEF4x2Gw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=fHmLjZnz; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710804842; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Y/UJD6UkjatoT2sa2f7cYALB+Y8wZfv5tBpC6qWKUlU=; b=fHmLjZnzKy5GF37Jj/o+klkg2aYBKHNEs7Ep7QWRLg3kHLsjbWK1+/tJ0hxY19iQaBRdPM /Z8PfZMxd3ANcf3KIY33/GtMfBuPnp/j67q91lwYrYGbAidhVuEkZX9VaE2Mwqe/cG1x+e RnK1Ti4hPxH1lC2z/TMET4cz4391FEQ= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-14-cKMRVEyGNuacM8ctBeGqLw-1; Mon, 18 Mar 2024 19:33:56 -0400 X-MC-Unique: cKMRVEyGNuacM8ctBeGqLw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E65141C05EAD; Mon, 18 Mar 2024 23:33:55 +0000 (UTC) Received: from virtlab701.virt.lab.eng.bos.redhat.com (virtlab701.virt.lab.eng.bos.redhat.com [10.19.152.228]) by smtp.corp.redhat.com (Postfix) with ESMTP id C01C81C060CE; Mon, 18 Mar 2024 23:33:55 +0000 (UTC) From: Paolo Bonzini To: linux-kernel@vger.kernel.org, kvm@vger.kernel.org Cc: michael.roth@amd.com, isaku.yamahata@intel.com, seanjc@google.com Subject: [PATCH v4 10/15] KVM: SEV: introduce to_kvm_sev_info Date: Mon, 18 Mar 2024 19:33:47 -0400 Message-ID: <20240318233352.2728327-11-pbonzini@redhat.com> In-Reply-To: <20240318233352.2728327-1-pbonzini@redhat.com> References: <20240318233352.2728327-1-pbonzini@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.7 Suggested-by: Sean Christopherson Signed-off-by: Paolo Bonzini --- arch/x86/kvm/svm/sev.c | 4 ++-- arch/x86/kvm/svm/svm.h | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c index 800e836a69fb..704cd42b4f1b 100644 --- a/arch/x86/kvm/svm/sev.c +++ b/arch/x86/kvm/svm/sev.c @@ -94,7 +94,7 @@ static int sev_flush_asids(unsigned int min_asid, unsigned int max_asid) static inline bool is_mirroring_enc_context(struct kvm *kvm) { - return !!to_kvm_svm(kvm)->sev_info.enc_context_owner; + return !!to_kvm_sev_info(kvm)->enc_context_owner; } static bool sev_vcpu_has_debug_swap(struct vcpu_svm *svm) @@ -679,7 +679,7 @@ static int __sev_launch_update_vmsa(struct kvm *kvm, struct kvm_vcpu *vcpu, clflush_cache_range(svm->sev_es.vmsa, PAGE_SIZE); vmsa.reserved = 0; - vmsa.handle = to_kvm_svm(kvm)->sev_info.handle; + vmsa.handle = to_kvm_sev_info(kvm)->handle; vmsa.address = __sme_pa(svm->sev_es.vmsa); vmsa.len = PAGE_SIZE; ret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_VMSA, &vmsa, error); diff --git a/arch/x86/kvm/svm/svm.h b/arch/x86/kvm/svm/svm.h index b7707514d042..6313679d464b 100644 --- a/arch/x86/kvm/svm/svm.h +++ b/arch/x86/kvm/svm/svm.h @@ -319,6 +319,11 @@ static __always_inline struct kvm_svm *to_kvm_svm(struct kvm *kvm) return container_of(kvm, struct kvm_svm, kvm); } +static __always_inline struct kvm_sev_info *to_kvm_sev_info(struct kvm *kvm) +{ + return &to_kvm_svm(kvm)->sev_info; +} + static __always_inline bool sev_guest(struct kvm *kvm) { #ifdef CONFIG_KVM_AMD_SEV -- 2.43.0