From nobody Wed Feb 01 16:01:55 2023 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4P6RW757q9z3cYbc; Wed, 1 Feb 2023 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4P6RW74fb0z4Q5y; Wed, 1 Feb 2023 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675267315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GPlNP7OftzsohOw4hq0/00ixvMSzIGE7Qjnlxia/bHc=; b=pHunOYTSbORaGoSekvhJiCjM/3oA9sdHgZvXGC368/8mi/xYIMzth5DtaCgpgSYBeHpN2h hEaQRa9WrsDEBxfZO16CdiVA4SyeDr8kftXkaCkAfH7xIFyISPO4eN8JC4LbYSEvsU7vUH eIimO/FsMLd9hiyf8NvSsEWcJeY49Flod7BRL84X0Zqeq45g7M+6Bt+7udWV+98ReS7rez yVP5HM2F+QjhmEOsEwanrhNHst7q6L0yZ/xrqfsUNfMCqdBsC5/u/UoVMDKjcnCHj8cOgh TM+rg9g2T2kcDsxiCJ7gUJJskKtW8JECCTS01Kb6waAatQnoGXt2eNkhUVWhAA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675267315; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=GPlNP7OftzsohOw4hq0/00ixvMSzIGE7Qjnlxia/bHc=; b=TzN7x9U9jt8ijLJaoBQtYsut4DwlsvBWae5H5jboO4SAPRITVHRiz3oIEf0lR7073cxk7N YgQQAhY8dfLbHCfHfgbysvgjcQka1TJzh2y6B/I3J3Sa/zumnMzdAZOTcrOw+MMJ8zodgy HFgh2uWgCvWIKFDLMvFLROUV6Ajb6saRHKSG5UFGhOjPAwu2PH/Pspyv2W1GW4uGWGyR5w xSDMNLmHSaFufRxo5+ecVi2GiP+11d4hBY91dPv/WF7VT0BZlVPAg0lK2BRpcIAlHNjT53 MSVw5GJAJkaOQXNRgNx6OnxjugJpiHS5LUCNOI9JYZ6WFE5gFZZmMFOKJD+O5A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675267315; a=rsa-sha256; cv=none; b=raBMF0235csGNpVGzCiLlhMp1u4G1tXGRJe8vquOvIWhcAmZ6cIuv2EpX10fOth3Y+ICgU u517rcm0B3jSbS28hc97YNSRpBrdHwx2Y6Vka0G/ncpFPS0yNxbLIZ17QzUr0+pIb2c23l nHSpLTROl25hxuduTxf5RRxUzpz1uHDrHTGXwwFVUQ4P9eEdpCfSh7QtKjYU3qsz2Pgvpn 2zmFtEt6dou7pm3uLXlsLddoX6OM9kAg7Ej0IAAx7wzaTUIYIj57FeuApBnrom4P/zAa1s sDlg0vLsPY5846fIMQqhirQvJABcMGrZ18uVh3meolZbYNeyOPzaroKZ/hisEg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4P6RW73hxZzKRn; Wed, 1 Feb 2023 16:01:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 311G1tmi026687; Wed, 1 Feb 2023 16:01:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 311G1tQY026686; Wed, 1 Feb 2023 16:01:55 GMT (envelope-from git) Date: Wed, 1 Feb 2023 16:01:55 GMT Message-Id: <202302011601.311G1tQY026686@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Wei Hu Subject: git: 6e5b082cab8d - main - arm64: Hyper-V: vPCI: Adding Hyper-V PCI protocol 1.4 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 6e5b082cab8d9dd0eb0bce65cf8cf268f11c7a25 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=6e5b082cab8d9dd0eb0bce65cf8cf268f11c7a25 commit 6e5b082cab8d9dd0eb0bce65cf8cf268f11c7a25 Author: Wei Hu AuthorDate: 2023-02-01 15:55:03 +0000 Commit: Wei Hu CommitDate: 2023-02-01 16:00:10 +0000 arm64: Hyper-V: vPCI: Adding Hyper-V PCI protocol 1.4 This is enabling the PCI protocol 1.4 and corresponding structures in order to support arm64 Hyper-V. This is the 2nd of the three patches to enable Hyper-V vPCI support in arm64. Reviewed by: whu Tested by: Souradeep Chakrabarti Obtained from: Souradeep Chakrabarti Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D37780 --- sys/dev/hyperv/pcib/vmbus_pcib.c | 83 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 80 insertions(+), 3 deletions(-) diff --git a/sys/dev/hyperv/pcib/vmbus_pcib.c b/sys/dev/hyperv/pcib/vmbus_pcib.c index 98e1320e4379..ca495dab9516 100644 --- a/sys/dev/hyperv/pcib/vmbus_pcib.c +++ b/sys/dev/hyperv/pcib/vmbus_pcib.c @@ -28,6 +28,7 @@ __FBSDID("$FreeBSD$"); #ifdef NEW_PCIB +#include "opt_acpi.h" #include #include @@ -50,6 +51,9 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(__aarch64__) +#include +#endif #include #include #include @@ -62,10 +66,16 @@ __FBSDID("$FreeBSD$"); #include #include #include "pcib_if.h" - +#if defined(__i386__) || defined(__amd64__) #include #include - +#endif +#if defined(__aarch64__) +#include +#include +#include +#include +#endif #include #include #include @@ -142,7 +152,7 @@ wait_for_completion_timeout(struct completion *c, int timeout) return (ret); } -#define PCI_MAKE_VERSION(major, minor) ((uint32_t)(((major) << 16) | (major))) +#define PCI_MAKE_VERSION(major, minor) ((uint32_t)(((major) << 16) | (minor))) enum { PCI_PROTOCOL_VERSION_1_1 = PCI_MAKE_VERSION(1, 1), @@ -182,6 +192,12 @@ enum pci_message_type { PCI_QUERY_PROTOCOL_VERSION = PCI_MESSAGE_BASE + 0x13, PCI_CREATE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x14, PCI_DELETE_INTERRUPT_MESSAGE = PCI_MESSAGE_BASE + 0x15, + PCI_RESOURCES_ASSIGNED2 = PCI_MESSAGE_BASE + 0x16, + PCI_CREATE_INTERRUPT_MESSAGE2 = PCI_MESSAGE_BASE + 0x17, + PCI_DELETE_INTERRUPT_MESSAGE2 = PCI_MESSAGE_BASE + 0x18, /* unused */ + PCI_BUS_RELATIONS2 = PCI_MESSAGE_BASE + 0x19, + PCI_RESOURCES_ASSIGNED3 = PCI_MESSAGE_BASE + 0x1A, + PCI_CREATE_INTERRUPT_MESSAGE3 = PCI_MESSAGE_BASE + 0x1B, PCI_MESSAGE_MAXIMUM }; @@ -223,6 +239,22 @@ struct pci_func_desc { uint32_t ser; /* serial number */ } __packed; +struct pci_func_desc2 { + uint16_t v_id; /* vendor ID */ + uint16_t d_id; /* device ID */ + uint8_t rev; + uint8_t prog_intf; + uint8_t subclass; + uint8_t base_class; + uint32_t subsystem_id; + union win_slot_encoding wslot; + uint32_t ser; /* serial number */ + uint32_t flags; + uint16_t virtual_numa_node; + uint16_t reserved; +} __packed; + + struct hv_msi_desc { uint8_t vector; uint8_t delivery_mode; @@ -231,6 +263,15 @@ struct hv_msi_desc { uint64_t cpu_mask; } __packed; +struct hv_msi_desc3 { + uint32_t vector; + uint8_t delivery_mode; + uint8_t reserved; + uint16_t vector_count; + uint16_t processor_count; + uint16_t processor_array[32]; +} __packed; + struct tran_int_desc { uint16_t reserved; uint16_t vector_count; @@ -288,6 +329,12 @@ struct pci_bus_relations { struct pci_func_desc func[0]; } __packed; +struct pci_bus_relations2 { + struct pci_incoming_message incoming; + uint32_t device_count; + struct pci_func_desc2 func[0]; +} __packed; + #define MAX_NUM_BARS (PCIR_MAX_BAR_0 + 1) struct pci_q_res_req_response { struct vmbus_chanpkt_hdr hdr; @@ -303,12 +350,26 @@ struct pci_resources_assigned { uint32_t reserved[4]; } __packed; +struct pci_resources_assigned2 { + struct pci_message message_type; + union win_slot_encoding wslot; + uint8_t memory_range[0x14][6]; /* not used here */ + uint32_t msi_descriptor_count; + uint8_t reserved[70]; +} __packed; + struct pci_create_interrupt { struct pci_message message_type; union win_slot_encoding wslot; struct hv_msi_desc int_desc; } __packed; +struct pci_create_interrupt3 { + struct pci_message message_type; + union win_slot_encoding wslot; + struct hv_msi_desc3 int_desc; +} __packed; + struct pci_create_int_response { struct pci_response response; uint32_t reserved; @@ -356,12 +417,28 @@ struct hv_pcibus { struct mtx config_lock; /* Avoid two threads writing index page */ struct mtx device_list_lock; /* Protect lists below */ + uint32_t protocol_version; TAILQ_HEAD(, hv_pci_dev) children; TAILQ_HEAD(, hv_dr_state) dr_list; volatile int detaching; }; +struct hv_pcidev_desc { + uint16_t v_id; /* vendor ID */ + uint16_t d_id; /* device ID */ + uint8_t rev; + uint8_t prog_intf; + uint8_t subclass; + uint8_t base_class; + uint32_t subsystem_id; + union win_slot_encoding wslot; + uint32_t ser; /* serial number */ + uint32_t flags; + uint16_t virtual_numa_node; +} __packed; + + struct hv_pci_dev { TAILQ_ENTRY(hv_pci_dev) link;