Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1607652rdb; Tue, 20 Feb 2024 01:05:50 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXHbSVaNq2Zw8xtAIzE1K6ia20fQG20MCMwJ9hYKfgJr9JEzJEq1lYZsdQqFz5uRK22EP8bZpBLvusAaTBgP8f7VtsOvA8XTjpZr4IlMg== X-Google-Smtp-Source: AGHT+IH/DEgR/ZorJlfdv3DyX/mrzAitvNCoU3iZbSS4p/aabVLkdJCz8hEmLqkkpC/vy0K47Xoa X-Received: by 2002:a17:906:1c07:b0:a3e:c2de:2b9e with SMTP id k7-20020a1709061c0700b00a3ec2de2b9emr2582538ejg.39.1708419950275; Tue, 20 Feb 2024 01:05:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708419950; cv=pass; d=google.com; s=arc-20160816; b=CG/vPJNqGhSAO0Yhag+9j0ytpx6bFUCZMLvgHsFDzKN5ZYaiIrUhiDwMILrVtI62xw a0LDXovotevKDy0fTHQNUuo1rb+eW3Xfe3gJvlFSrdEonLmv5g9cc3UeWhLoAywq/ao3 P6IR87a2udCY7kfaW+V2UhIHTt4OvckgCltV48Lcv1tR+oXLj0NP1N/FIwllnf7b+DwA 76VeBRBFITZmM772KmRPhNqyV7M3xtxiFYygnqumXvQjbwKJJlMJQQnRFGOgemOpvMc5 xvsshdJ7YzmxXvtiVruWjI5hydBAq/T+nQAjvAmnJQetcddWijBzNpioymh2c4CqP7Qp O8pA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :from:dkim-signature; bh=s+OmS3xJIO7hb5gJugts8YXFx8Npo3EjobwfBSBe6mM=; fh=TOMXgEU5qcg90Pd/IJbdJ2VK7h3gc/SuIlFW7SceSxQ=; b=JEN/hnzuzT8hryMU0xictKoGfUbXBdE0Kn+LJ4IGMWxr8y+lJOR23zhkFS1QGy58/Y +CfinXc6/wZEPv8GgBT67JfgVl5xn3j3RmOhAp33wMtCIYurtSDdWHLl93/bxxGJ9ml6 cZ/XYmyYbcHXmzFNITtjEArKWHldAnuTc7xbF+cBIioccat7v9ixFyiykdS9fELwoXRI N+SkAovTl2SvBKk9yza+ArXgRTeZwmmbRN8W0m+Yhr7KUVOMPQW5B4Z60eMlXNzgAh7g o+ARRxR29Md6M0eujmmOvK5xOVwimVrYfWiPkapWUvg7hYLgXsMY46wkCwAz45MiNcb+ FCtw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ncIqjJ42; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-72643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72643-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qx22-20020a170906fcd600b00a3e422feb5esi2469419ejb.443.2024.02.20.01.05.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Feb 2024 01:05:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-72643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ncIqjJ42; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-72643-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-72643-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0C5091F24FF8 for ; Tue, 20 Feb 2024 09:05:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C95B763104; Tue, 20 Feb 2024 09:03:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ncIqjJ42" Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 544B75D8EA; Tue, 20 Feb 2024 09:03:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708419816; cv=none; b=OVaI0/yGYtU5P6CKDtfafwMMMje18aorJgeBvJD5o+pgEP+yjW6MugI/Q1HM03JgxR/qBY0XExw0L3yvYLId+F9g61zCxEn27C3gFOlCft2ZBiVc3qMISu94ok7ebxCZOCkvv95nn8XPjVt4dtBq9qrKrCnPvlEqvXcMkGalAO8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708419816; c=relaxed/simple; bh=+QEWfSHhYBKuafjCwRIfOA10sASx6MgTqjF9OOhMZfw=; h=From:Message-ID:Date:MIME-Version:Subject:To:Cc:References: In-Reply-To:Content-Type; b=B6C7mrONgJvzGR+RX/wCY8mBY0DwgqDyjJTDJvVsQdGUavdjWRJo3WHJ8UQT3I4mmYOAL0qFrztRSl8ukGk8HPZGVLsUWoXNyHJtGaUDKRtYrl4YHNjB8fO/BTo7OTe809eqVoJW5aA+XtqMo5mnsH2qFe3zP6fpvDz5zlK94O0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ncIqjJ42; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-33d36736d4eso1690013f8f.1; Tue, 20 Feb 2024 01:03:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708419812; x=1709024612; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:from:to:cc:subject:date:message-id:reply-to; bh=s+OmS3xJIO7hb5gJugts8YXFx8Npo3EjobwfBSBe6mM=; b=ncIqjJ42GRWsPJXQ4vL99HAmBoK4ClzKSITAjG8xO0pHqYiybXNm5A3LXPbmWZuccd spfFj6ytsmfYmKkupcnbxpPdDaPyBc333SDl4CDqSN9d31zSCQth/4gnzFv+TaeokRVi aJyB69RUdgGMfZcJBkvqoxEul2Bnir+A448cGLkuYG20Q+aYCWAay2ogdzRZ/1T1VIlr vCj089ERY+5/twt1zRF9nLQnMu1QHeWIPyEpumsh2039e94KPHYa+UnqqU85IhCnPfCH WDT1Xm+2vYced8tSLqpRX9FRCg0Z1ufx4Id7wgQq6cQ9kjomSckuyx07GL0fIRuwf2GH cKIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708419812; x=1709024612; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:user-agent:mime-version:date :message-id:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s+OmS3xJIO7hb5gJugts8YXFx8Npo3EjobwfBSBe6mM=; b=Hxu3qs3SdmZ+6l4LQwN4YFRPaYnT8HtIVv5bDjGB55byebQ5KZRKuid3FTfKnXjMf2 gyXyiok96GoUgST0LiyI/MqeggqBPM31PLz9IDpDtZVDGCVCZspoRGXMYpiYHTeYSa4b UGrlXkeYgos2iegJNJFhA/+n4WbtGom/ZIeIjAEFEkO+o6tTsvgx8egqRB+Fmyb/VH7q 7DM01w7GNfdRWRDlNHdBuCWpm/c2zKRcj1wG620FXSKAKLAVha318FUc9olI244aMbRR 9rxa6yX7khu9NhbBxYPgcfUyz7amXi3e91ZwW7ojwKtigiCamf8Yc2umwpFimJObS5E0 bQOg== X-Forwarded-Encrypted: i=1; AJvYcCX8OeIRpcUFiyGXkEoLsaPloy2+E3DjqJ3nEj6s//ZRQbO8A+ydw/+wILGHtNKxvUT+VURvd2aEKv42AgggtW91aZlMntkLUmKInfcyI8NtJyCvsEAGdaTwrLRiusetHviA8lpakTR6kgFziqb/iBJtOTRyj+Pbwa6EOFv+0aCHc/2FoslVSf56/lKALicAVX0Nfsg1mAqUPBX74b36ePS08Fa+hheQkxqL/8iKVMgmY+qE61nASj3nvQ== X-Gm-Message-State: AOJu0YyXBZymyXbRtScwdm4KoZvLcaFEDe0zFQfBalKRbR1c5++A/zcq FR4o6oCaMU9SdY6iWR0fJ5LmgOL4bS+Im20AY+MlFBDGfOx6A/tk X-Received: by 2002:a5d:4104:0:b0:33b:4d24:18c7 with SMTP id l4-20020a5d4104000000b0033b4d2418c7mr9232891wrp.9.1708419812576; Tue, 20 Feb 2024 01:03:32 -0800 (PST) Received: from [10.24.67.19] ([15.248.2.239]) by smtp.gmail.com with ESMTPSA id bx15-20020a5d5b0f000000b0033d202abf01sm12058043wrb.28.2024.02.20.01.03.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 20 Feb 2024 01:03:32 -0800 (PST) From: Paul Durrant X-Google-Original-From: Paul Durrant Message-ID: <0f290ba9-4fd1-4986-8562-b90706fd1b5d@xen.org> Date: Tue, 20 Feb 2024 09:03:30 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: paul@xen.org Subject: Re: [PATCH v13 12/21] KVM: x86/xen: allow shared_info to be mapped by fixed HVA Content-Language: en-US To: Sean Christopherson Cc: Paolo Bonzini , Jonathan Corbet , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , David Hildenbrand , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , David Woodhouse , Shuah Khan , kvm@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, linux-kselftest@vger.kernel.org References: <20240215152916.1158-1-paul@xen.org> <20240215152916.1158-13-paul@xen.org> Organization: Xen Project In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 19/02/2024 21:53, Sean Christopherson wrote: > On Thu, Feb 15, 2024, Paul Durrant wrote: >> @@ -715,13 +731,23 @@ int kvm_xen_hvm_get_attr(struct kvm *kvm, struct kvm_xen_hvm_attr *data) >> break; >> >> case KVM_XEN_ATTR_TYPE_SHARED_INFO: >> - if (kvm->arch.xen.shinfo_cache.active) >> + if (kvm->arch.xen.shinfo_cache.active && >> + kvm->arch.xen.shinfo_cache.gpa != KVM_XEN_INVALID_GPA) > > This should really use INVALID_GPA when checking internal gpc state. Mostly to > help clarify what is/isn't KVM Xen ABI, but also because I don't like the subtle > assumption that KVM_XEN_INVALID_GPA == INVALID_GPA. > Sorry, yes, that was miss on my part. > Even better, if we slot in two helpers when the HVA-based GPC support is added, > then the Xen code doesn't need to to make assumptions about how the GPC code > manages HVA vs. GPA internally. E.g. if we ever refactor the code again and use > a dedicated flag instead of gpc->gpa as the implicit flag. > > static inline bool kvm_gpc_is_gpa_active(struct gfn_to_pfn_cache *gpc) > { > return gpc->active && !kvm_is_error_gpa(gpc->gpa); > } > > static inline bool kvm_gpc_is_hva_active(struct gfn_to_pfn_cache *gpc) > { > return gpc->active && kvm_is_error_gpa(gpc->gpa); > } Sure, sounds good to me. I'll add those.