Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp3394318ybl; Sun, 2 Feb 2020 22:51:51 -0800 (PST) X-Google-Smtp-Source: APXvYqymedH4bAvmVYguMZ+V2WgIGKT1br+qZsDNvdaAF6pyWM110mB8xuepiRMUkK2KklrRq7cJ X-Received: by 2002:a9d:4e92:: with SMTP id v18mr15709959otk.47.1580712711518; Sun, 02 Feb 2020 22:51:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580712711; cv=none; d=google.com; s=arc-20160816; b=yFNMnOP5WTkAPPU6CDZhXy7WAZ1rdi6jiQT3X/jvi1VIr3CvXJr71TBM/tmJ4y4Xsb 6LSGDpsCySjRYNx183FhrEcUBNGnwjtVgs5PZv0yeDaSCPUvFsaKOQqXUKCPTruBDM6o kPbUEQr0/FSYha7lN4623D9IXnarDIO0H2yJvVOP4ieQjGTRfq1qtnEYkO8UoOgP3Gna 7mgEoOXSMD9eQVpsnh0Z9In53oSubekEuuPBIZ9ipDh36ht7vqjc8sS79aL+W1Wka9HI 0oi8wNVEzeyZQEiSbJQBOeLVbJTrDwp4nlBjPhU0/gfAaqpuy7DAxJp69t/yhiM2hetf ueIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VWTud8x7OEQoKdUBzIWswexdHpo1+5LgfuhOzNRvQBY=; b=GtTS4VcsXUl4Yx+r8Gl8+Y2lHIY0ydRaDIryd0r5REB1wk2hOi6T5IIoC3rkPdQQQR Nl2pUpC/JE0gPQHr2CKUwx+aUZb05tHDrQYxYyZAaSBSB3NIxO9JTdJWw2ML3qgKGhOn 0/tfoYSWlK6vZwKjPF+ei3HZCF4ZRTuiVJx80PVN2/Peru60LNfvBVkT6KnfcpwoRpFC UElOQbHdMSVNMNhQXfYGqxG2ECaacPxbMDsSgF+XwG8ahlqG3htdKf3gOMkRvdMG2mgm HT/ONq90wVRKZ5ob/CJ5136wUDnoDkPByluBmpRxqOnxQUqcILdXYSVzGpS+yHo/hJx9 PDGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Je3IggfF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m19si8814846otq.40.2020.02.02.22.51.40; Sun, 02 Feb 2020 22:51:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Je3IggfF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727164AbgBCFD0 (ORCPT + 99 others); Mon, 3 Feb 2020 00:03:26 -0500 Received: from mail-qt1-f195.google.com ([209.85.160.195]:41707 "EHLO mail-qt1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726884AbgBCFDZ (ORCPT ); Mon, 3 Feb 2020 00:03:25 -0500 Received: by mail-qt1-f195.google.com with SMTP id l19so10461864qtq.8; Sun, 02 Feb 2020 21:03:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=VWTud8x7OEQoKdUBzIWswexdHpo1+5LgfuhOzNRvQBY=; b=Je3IggfFJOMJPyKlJs2Q26RgeI8BKzwhWYUwEY4gEBeVY8aUpxD7JfaatuG/QPzVyi QTC6uC85PbWUOOYlTZMwUKvDMueLZiQuNfIT5PU3rSefJf3WgVOKgbXMW0UFG0KXzQQy qi8KpEu27q0Yhngm00UL5U8S6fBgkJoyihzyzi8hZ9RvVd3RnlKtjgodfQgatu5uansU slmwvbmPzqgTQTDf32r/pXndLhudg0FP8euKBBaefsE46CLvsZbo8vCGgudYdDE9VPKq UOidPibovyBJ9M29M4FY5Qn7tIYD/cedG3bbU/nqgOJ1CFB1vjiQTE29BuusDc3Hl1aW f3Zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=VWTud8x7OEQoKdUBzIWswexdHpo1+5LgfuhOzNRvQBY=; b=m4gP1rQdtt18lnWcPcSqdwOaWOhIlwKLtnZnjgd25mNVmHgCDQV9uFLA5pfX7QEMx0 WfGEcX+aFO9lv+/5T9OQ1UGeuP+TDV/FsgS4ZiM0bIuVWUOCVWNdGxOo8UZ17BS6AWxh 6TGuDt+1v6B5sCKdgRn5d0WC+HBiSHVmHRiOVL2sSH5GfDTVRfa9oHnLzXbo8ytVNIHr uQDtGnvV1kn2xBoiyoQLeI/iDgCGzqNPQCKb51dyqie5448eRJ4wP1szjyyxQzesmZkh KAMN8od+kq4isfo572gvdKlWtx1dNi1mIWTOBTpgQA0cDUVS1o6bCLA4dF2eyFdspl1M hmUA== X-Gm-Message-State: APjAAAXW9TkR8sKjFQpbpmgCLv4CaEN2G6oa55t7Svuqx4UbdyuiEnWT 52z/Urt04kRCqYEVOCRTHz4= X-Received: by 2002:aed:3e0e:: with SMTP id l14mr22512050qtf.163.1580706204616; Sun, 02 Feb 2020 21:03:24 -0800 (PST) Received: from auth1-smtp.messagingengine.com (auth1-smtp.messagingengine.com. [66.111.4.227]) by smtp.gmail.com with ESMTPSA id o187sm8804094qkf.26.2020.02.02.21.03.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Feb 2020 21:03:24 -0800 (PST) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailauth.nyi.internal (Postfix) with ESMTP id A11C121F40; Mon, 3 Feb 2020 00:03:23 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 03 Feb 2020 00:03:23 -0500 X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrgeeigdejjecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenog fuohhrthgvugftvggtihhpvdculdegtddmnecujfgurhephffvufffkffojghfggfgsedt keertdertddtnecuhfhrohhmpeeuohhquhhnucfhvghnghcuoegsohhquhhnrdhfvghngh esghhmrghilhdrtghomheqnecukfhppeehvddrudehhedrudduuddrjedunecuvehluhhs thgvrhfuihiivgepudenucfrrghrrghmpehmrghilhhfrhhomhepsghoqhhunhdomhgvsh hmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedtieegqddujeejkeehheeh vddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfhhigihmvgdrnhgrmhgv X-ME-Proxy: Received: from localhost (unknown [52.155.111.71]) by mail.messagingengine.com (Postfix) with ESMTPA id 22030328005A; Mon, 3 Feb 2020 00:03:22 -0500 (EST) From: Boqun Feng To: linux-pci@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Michael Kelley , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Sasha Levin , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Lorenzo Pieralisi , Andrew Murray , Bjorn Helgaas , Boqun Feng Subject: [PATCH v2 3/3] PCI: hv: Introduce hv_msi_entry Date: Mon, 3 Feb 2020 13:03:13 +0800 Message-Id: <20200203050313.69247-4-boqun.feng@gmail.com> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200203050313.69247-1-boqun.feng@gmail.com> References: <20200203050313.69247-1-boqun.feng@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a new structure (hv_msi_entry), which is also defined int tlfs, to describe the msi entry for HVCALL_RETARGET_INTERRUPT. The structure is needed because its layout may be different from architecture to architecture. Also add a new generic interface hv_set_msi_address_from_desc() to allow different archs to set the msi address from msi_desc. No functional change, only preparation for the future support of virtual PCI on non-x86 architectures. Signed-off-by: Boqun Feng (Microsoft) --- arch/x86/include/asm/hyperv-tlfs.h | 11 +++++++++-- arch/x86/include/asm/mshyperv.h | 5 +++++ drivers/pci/controller/pci-hyperv.c | 4 ++-- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 4a76e442481a..953b3ad38746 100644 --- a/arch/x86/include/asm/hyperv-tlfs.h +++ b/arch/x86/include/asm/hyperv-tlfs.h @@ -912,11 +912,18 @@ struct hv_partition_assist_pg { u32 tlb_lock_count; }; +union hv_msi_entry { + u64 as_uint64; + struct { + u32 address; + u32 data; + } __packed; +}; + struct hv_interrupt_entry { u32 source; /* 1 for MSI(-X) */ u32 reserved1; - u32 address; - u32 data; + union hv_msi_entry msi_entry; } __packed; /* diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 6b79515abb82..3bdaa3b6e68f 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -240,6 +240,11 @@ bool hv_vcpu_is_preempted(int vcpu); static inline void hv_apic_init(void) {} #endif +#define hv_set_msi_address_from_desc(msi_entry, msi_desc) \ +do { \ + (msi_entry)->address = (msi_desc)->msg.address_lo; \ +} while (0) + #else /* CONFIG_HYPERV */ static inline void hyperv_init(void) {} static inline void hyperv_setup_mmu_ops(void) {} diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 0d9b74503577..2240f2b3643e 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1170,8 +1170,8 @@ static void hv_irq_unmask(struct irq_data *data) memset(params, 0, sizeof(*params)); params->partition_id = HV_PARTITION_ID_SELF; params->int_entry.source = 1; /* MSI(-X) */ - params->int_entry.address = msi_desc->msg.address_lo; - params->int_entry.data = msi_desc->msg.data; + hv_set_msi_address_from_desc(¶ms->int_entry.msi_entry, msi_desc); + params->int_entry.msi_entry.data = msi_desc->msg.data; params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | (hbus->hdev->dev_instance.b[4] << 16) | (hbus->hdev->dev_instance.b[7] << 8) | -- 2.24.1