From patchwork Thu Jan 23 14:03:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 11348197 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F298813A4 for ; Thu, 23 Jan 2020 14:05:27 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CEE3F21835 for ; Thu, 23 Jan 2020 14:05:27 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=amazon.com header.i=@amazon.com header.b="nHxXwMMa" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CEE3F21835 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iud4w-0008MX-EK; Thu, 23 Jan 2020 14:03:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iud4u-0008M6-Fp for xen-devel@lists.xenproject.org; Thu, 23 Jan 2020 14:03:24 +0000 X-Inumbo-ID: 1ea7d1dc-3de9-11ea-9fd7-bc764e2007e4 Received: from smtp-fw-4101.amazon.com (unknown [72.21.198.25]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 1ea7d1dc-3de9-11ea-9fd7-bc764e2007e4; Thu, 23 Jan 2020 14:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1579788204; x=1611324204; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=J0OSpCkxgbb45Ar9TZuQOtuQ/qndGg9lpGrrowOYrwY=; b=nHxXwMMaowiN/8PkEkqz4yJSdwbfVPkCCUpsW3Gg5HOPIR0wM7rcksco 8NJeJzFTF9i0zd1VXF0kF3uErDM5rfg+WVVDY5EjCem5pvw77CahVoZg7 Mmp7q36BwNstmBZ5xOZElP/BNXlhayNap5PkD2WhwVpky1XDsEZhmlUlS I=; IronPort-SDR: PsV36s4T/pw4kIEF6y77C5r+FSd+0JeBWVLTzPEBb3XgkzOOXwSVYxxhGlQUQ5QdMP1/r2uzsI G5Xs8bcEqdtA== X-IronPort-AV: E=Sophos;i="5.70,354,1574121600"; d="scan'208";a="13777640" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-119b4f96.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-4101.iad4.amazon.com with ESMTP; 23 Jan 2020 14:03:22 +0000 Received: from EX13MTAUEA002.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-119b4f96.us-west-2.amazon.com (Postfix) with ESMTPS id 598CD1A0B9C; Thu, 23 Jan 2020 14:03:19 +0000 (UTC) Received: from EX13D32EUB001.ant.amazon.com (10.43.166.125) by EX13MTAUEA002.ant.amazon.com (10.43.61.77) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Thu, 23 Jan 2020 14:03:19 +0000 Received: from EX13MTAUEB002.ant.amazon.com (10.43.60.12) by EX13D32EUB001.ant.amazon.com (10.43.166.125) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Thu, 23 Jan 2020 14:03:18 +0000 Received: from u2f063a87eabd5f.cbg10.amazon.com (10.125.106.135) by mail-relay.amazon.com (10.43.60.234) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Thu, 23 Jan 2020 14:03:09 +0000 From: Paul Durrant To: Date: Thu, 23 Jan 2020 14:03:04 +0000 Message-ID: <20200123140305.21050-3-pdurrant@amazon.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200123140305.21050-1-pdurrant@amazon.com> References: <20200123140305.21050-1-pdurrant@amazon.com> MIME-Version: 1.0 Precedence: Bulk Subject: [Xen-devel] [PATCH v3 2/3] x86 / hvm: add domain_relinquish_resources() method X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Kevin Tian , Wei Liu , Andrew Cooper , Paul Durrant , Jun Nakajima , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" There are two functions in hvm.c to deal with tear-down and a domain: hvm_domain_relinquish_resources() and hvm_domain_destroy(). However, only the latter has an associated method in 'hvm_funcs'. This patch adds a method for the former. A subsequent patch will define a VMX implementation. Signed-off-by: Paul Durrant Acked-by: Jan Beulich --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Wei Liu Cc: "Roger Pau Monné" Cc: Jun Nakajima Cc: Kevin Tian v2: - Make the new method optional and make it an alternative_vcall --- xen/arch/x86/hvm/hvm.c | 3 +++ xen/include/asm-x86/hvm/hvm.h | 1 + 2 files changed, 4 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 4723f5d09c..e51c077269 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -715,6 +715,9 @@ int hvm_domain_initialise(struct domain *d) void hvm_domain_relinquish_resources(struct domain *d) { + if ( hvm_funcs.domain_relinquish_resources ) + alternative_vcall(hvm_funcs.domain_relinquish_resources, d); + if ( hvm_funcs.nhvm_domain_relinquish_resources ) hvm_funcs.nhvm_domain_relinquish_resources(d); diff --git a/xen/include/asm-x86/hvm/hvm.h b/xen/include/asm-x86/hvm/hvm.h index 09793c12e9..9eab1d7493 100644 --- a/xen/include/asm-x86/hvm/hvm.h +++ b/xen/include/asm-x86/hvm/hvm.h @@ -107,6 +107,7 @@ struct hvm_function_table { * Initialise/destroy HVM domain/vcpu resources */ int (*domain_initialise)(struct domain *d); + void (*domain_relinquish_resources)(struct domain *d); void (*domain_destroy)(struct domain *d); int (*vcpu_initialise)(struct vcpu *v); void (*vcpu_destroy)(struct vcpu *v);