From patchwork Mon Mar 18 11:20:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 10857397 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 96FC21709 for ; Mon, 18 Mar 2019 11:23:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7CCDC2937E for ; Mon, 18 Mar 2019 11:23:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 711F82937F; Mon, 18 Mar 2019 11:23:06 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C7D629384 for ; Mon, 18 Mar 2019 11:23:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h5qKK-0004F4-3d; Mon, 18 Mar 2019 11:21:08 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h5qKI-0004Ej-7s for xen-devel@lists.xenproject.org; Mon, 18 Mar 2019 11:21:06 +0000 X-Inumbo-ID: eaf6ef20-496f-11e9-bc90-bc764e045a96 Received: from SMTP03.CITRIX.COM (unknown [162.221.156.55]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP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zwMBCCF3BjiR35E9LggDUqAFKZWm72c/kczJxQkxKteiIYhd6TZGi9PmfRa+zDO0ByG8 G9mAm+wNccO30gcBhl02V5YMS1RuyWcjhZbKQhyQZkIjj6PEq0ut04t8QcKhXew1fX4+/fWR laqyXS7z7rWfJEtMVg1xD3kXQgPGgpAwpo8zeMWtlzZhGzFyC70dqTgsyw4HZqc6K27C137c fcIV8dnQlJ1XBSQFOdSlCUK/Cd3700avxj9eU+DzAkF8rLG5JUnJCxa9wQFieNB4hIk15Q9S x2PARd0mGtUJhjJLcYQZVl28TQUoz4H0/DKJ3fvpTM5WF4eR6UqkxzS9fgN+Ylzrv/yJHdfl GX13rNe1+eWHj9B4X5rPWpwBW3V057hZXNDfOQHCaRqDnPDQ4FQi3DQSDP56Q6acINXwpt86 V+bIorsevZAERtLmALByGD6jGXR1f4EOjduYwADhqEeEb8LyYKd3lkQg6dQzW9EUjU6ryh4i 8bnERU5sVdExN7hsl98gmCue8PWd6U5aGDfA/AtN5zfXoBZA+tNdFgVM4vB6K9UvEwnrQoBz dnDKUO4CWpHhcYqkAcNtgyZffUcNWi53JA9yqDGLivuTytlUB8idIDQfgn1kkTFYoTS9khPy /RzzY6Qef8e6sx8696lY968jVM4w7wd7fTeTiSadf8IX1cQTDAT87S9oMbspiRvR0V5q/03x iWO8hqNWIio4FQHonnMh//0tcChXPGEZxyTgitHBx9HTl2MEKSDvk+eYJpLZJqYfX6QK8lZ3 QkXkcM7glDhO8QyRXu6h4VI2FMDfJhJ5jJ19LhrkxVZxMNz55TgYvODQI= X-IronPort-AV: E=Sophos;i="5.58,493,1544486400"; d="scan'208";a="80850932" From: Paul Durrant To: Date: Mon, 18 Mar 2019 11:20:49 +0000 Message-ID: <20190318112059.21910-2-paul.durrant@citrix.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190318112059.21910-1-paul.durrant@citrix.com> References: <20190318112059.21910-1-paul.durrant@citrix.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH v8 01/11] viridian: add init hooks X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Paul Durrant , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP This patch adds domain and vcpu init hooks for viridian features. The init hooks do not yet do anything; the functionality will be added to by subsequent patches. Signed-off-by: Paul Durrant Reviewed-by: Wei Liu Acked-by: Jan Beulich --- Cc: Andrew Cooper Cc: "Roger Pau Monné" v5: - Put the call to viridian_domain_deinit() back into hvm_domain_relinquish_resources() where it should be v3: - Re-instate call from domain deinit to vcpu deinit - Move deinit calls to avoid introducing new labels v2: - Remove call from domain deinit to vcpu deinit --- xen/arch/x86/hvm/hvm.c | 10 ++++++++++ xen/arch/x86/hvm/viridian/viridian.c | 10 ++++++++++ xen/include/asm-x86/hvm/viridian.h | 3 +++ 3 files changed, 23 insertions(+) diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 8adbb61b57..11ce21fc08 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -666,6 +666,10 @@ int hvm_domain_initialise(struct domain *d) if ( hvm_tsc_scaling_supported ) d->arch.hvm.tsc_scaling_ratio = hvm_default_tsc_scaling_ratio; + rc = viridian_domain_init(d); + if ( rc ) + goto fail2; + rc = hvm_funcs.domain_initialise(d); if ( rc != 0 ) goto fail2; @@ -687,6 +691,7 @@ int hvm_domain_initialise(struct domain *d) hvm_destroy_cacheattr_region_list(d); destroy_perdomain_mapping(d, PERDOMAIN_VIRT_START, 0); fail: + viridian_domain_deinit(d); return rc; } @@ -1526,6 +1531,10 @@ int hvm_vcpu_initialise(struct vcpu *v) && (rc = nestedhvm_vcpu_initialise(v)) < 0 ) /* teardown: nestedhvm_vcpu_destroy */ goto fail5; + rc = viridian_vcpu_init(v); + if ( rc ) + goto fail5; + rc = hvm_all_ioreq_servers_add_vcpu(d, v); if ( rc != 0 ) goto fail6; @@ -1553,6 +1562,7 @@ int hvm_vcpu_initialise(struct vcpu *v) fail2: hvm_vcpu_cacheattr_destroy(v); fail1: + viridian_vcpu_deinit(v); return rc; } diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridian/viridian.c index 425af56856..5b0eb8a8c7 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -417,6 +417,16 @@ int guest_rdmsr_viridian(const struct vcpu *v, uint32_t idx, uint64_t *val) return X86EMUL_OKAY; } +int viridian_vcpu_init(struct vcpu *v) +{ + return 0; +} + +int viridian_domain_init(struct domain *d) +{ + return 0; +} + void viridian_vcpu_deinit(struct vcpu *v) { viridian_synic_wrmsr(v, HV_X64_MSR_VP_ASSIST_PAGE, 0); diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/viridian.h index ec5ef8d3f9..f072838955 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -80,6 +80,9 @@ viridian_hypercall(struct cpu_user_regs *regs); void viridian_time_ref_count_freeze(struct domain *d); void viridian_time_ref_count_thaw(struct domain *d); +int viridian_vcpu_init(struct vcpu *v); +int viridian_domain_init(struct domain *d); + void viridian_vcpu_deinit(struct vcpu *v); void viridian_domain_deinit(struct domain *d);