Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1112181pxu; Wed, 6 Jan 2021 12:37:27 -0800 (PST) X-Google-Smtp-Source: ABdhPJwyWoh69PBTzPqIqnl0FMJ4O5MlPMaS7s7O+pFY19K5cvFYff3cnrxT7vXyN0PTTXEr/rbf X-Received: by 2002:a05:6402:1597:: with SMTP id c23mr5231180edv.212.1609965447692; Wed, 06 Jan 2021 12:37:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609965447; cv=none; d=google.com; s=arc-20160816; b=uPQLPrcll9ce1lnzJgOFYRJRclB1B3TWp31qS2tBfSeDModh3cMC/kNgr39TNxwlU6 wuu6426+lm4jChWJXTiEmDEANqd5YsRnbBy13sgtYrgQ8nWwy+Ucqq1YJ1nqxDK2RyD0 o7pk8j5I3BMT5pEvOGT6/dsjaIkA9MqquhnUUKW4dmdY+jNL6WnYcV+F0m+aeRXTDvjf 2ln3eLh93NOA23z1DK7Se2GBi7pBGC8AcKfazXZ7B0URURuiQq5IMp4nE4uhpJ65womi 67TYqo234iXAfyKH87qJQD0LQKRKZ9xfMOpyJhAPjDPpbrW8+fjfYdtceHx7xbO2Xiro xVCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=iSy+7CaWmr7dYr0SNSPrl+Q/2IeK6S5L4pZcI30bMis=; b=0YHsnBdCrzgkzv8PdbzSIgf/s3JF1+KleYmJfUfDQsrArFFh+PFoG3hFyy5sHjQaOB ACPg+stCaC8R0o4iucRFpYINyUHriPVHc07QpFO5NC/f6yPyx4bM0wAuyiFVaXmp2whA qpgWeQ2QkFtR+HNNgrXQvR+3brZnFD7i2ygHTm/G4d4a2ciIoxTRBM7ekeSLa2xfSosx MlwKYVFSPW8ix/IVXVeCg406obKiya3lcSZ6CBY8EOa3Ozty9ep+t40kBTxkkRwozGSM 4USfy54bztDbhOWNvWMcEIIwxjEoh8Y6xw8PO1xSMJ6So35OUkWskEAnx7bCU7DgdL5b HSpg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id am1si1287687ejc.463.2021.01.06.12.36.59; Wed, 06 Jan 2021 12:37:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727614AbhAFUet (ORCPT + 99 others); Wed, 6 Jan 2021 15:34:49 -0500 Received: from mail-wm1-f54.google.com ([209.85.128.54]:33093 "EHLO mail-wm1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727499AbhAFUet (ORCPT ); Wed, 6 Jan 2021 15:34:49 -0500 Received: by mail-wm1-f54.google.com with SMTP id n16so3779956wmc.0; Wed, 06 Jan 2021 12:34:32 -0800 (PST) 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=iSy+7CaWmr7dYr0SNSPrl+Q/2IeK6S5L4pZcI30bMis=; b=hxlLox3FDttuZPJBeqDJugvcBH9UtvKdWtgCVI9gQvdRaI2LCMxqMnZo1OLO7Orc7S RUxxCqpt9fyC7KNWkZ+zUsEx3MqydO9DES+FDxfCG8sLmMV8aouWiGMUckcxM4I/djzB kkqYqdzsvJ7J6swzsz8dlZE7XQ/0F3COo12eRL7FsLVQRQg0pK1Pi9Xbpqkg8xa4bZ5A bYHbIEBvYyBuNZsDet79d0lIWzmrRls0iWtrDts3go2u7gzuuLHiaHV1FwOY6ok8Bbne 9SBcD9mRTM7QOBvJMi4xOexf6DOUUPE6hcOBxIAT11ucI9AmIRQX8UzTaS4n317qZNUQ g18g== X-Gm-Message-State: AOAM531fAirvsvZSphKKK15y0pj/sSjAzB8ktVHpqSErPUPC5QAvqdFh dim9Ci4Nk6SruXpanBzW54QDNs4KAtg= X-Received: by 2002:a1c:4c07:: with SMTP id z7mr5164429wmf.142.1609965246630; Wed, 06 Jan 2021 12:34:06 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id u9sm4499456wmb.32.2021.01.06.12.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jan 2021 12:34:06 -0800 (PST) From: Wei Liu To: Linux on Hyper-V List Cc: virtualization@lists.linux-foundation.org, Linux Kernel List , Michael Kelley , Vineeth Pillai , Sunil Muthuswamy , Nuno Das Neves , Wei Liu , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Arnd Bergmann , linux-arch@vger.kernel.org (open list:GENERIC INCLUDE/ASM HEADER FILES) Subject: [PATCH v4 13/17] asm-generic/hyperv: introduce hv_device_id and auxiliary structures Date: Wed, 6 Jan 2021 20:33:46 +0000 Message-Id: <20210106203350.14568-14-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210106203350.14568-1-wei.liu@kernel.org> References: <20210106203350.14568-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org We will need to identify the device we want Microsoft Hypervisor to manipulate. Introduce the data structures for that purpose. They will be used in a later patch. Signed-off-by: Sunil Muthuswamy Co-Developed-by: Sunil Muthuswamy Signed-off-by: Wei Liu --- include/asm-generic/hyperv-tlfs.h | 79 +++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h index 8423bf53c237..42ff1326c6bd 100644 --- a/include/asm-generic/hyperv-tlfs.h +++ b/include/asm-generic/hyperv-tlfs.h @@ -623,4 +623,83 @@ struct hv_set_vp_registers_input { } element[]; } __packed; +enum hv_device_type { + HV_DEVICE_TYPE_LOGICAL = 0, + HV_DEVICE_TYPE_PCI = 1, + HV_DEVICE_TYPE_IOAPIC = 2, + HV_DEVICE_TYPE_ACPI = 3, +}; + +typedef u16 hv_pci_rid; +typedef u16 hv_pci_segment; +typedef u64 hv_logical_device_id; +union hv_pci_bdf { + u16 as_uint16; + + struct { + u8 function:3; + u8 device:5; + u8 bus; + }; +} __packed; + +union hv_pci_bus_range { + u16 as_uint16; + + struct { + u8 subordinate_bus; + u8 secondary_bus; + }; +} __packed; + +union hv_device_id { + u64 as_uint64; + + struct { + u64 :62; + u64 device_type:2; + }; + + /* HV_DEVICE_TYPE_LOGICAL */ + struct { + u64 id:62; + u64 device_type:2; + } logical; + + /* HV_DEVICE_TYPE_PCI */ + struct { + union { + hv_pci_rid rid; + union hv_pci_bdf bdf; + }; + + hv_pci_segment segment; + union hv_pci_bus_range shadow_bus_range; + + u16 phantom_function_bits:2; + u16 source_shadow:1; + + u16 rsvdz0:11; + u16 device_type:2; + } pci; + + /* HV_DEVICE_TYPE_IOAPIC */ + struct { + u8 ioapic_id; + u8 rsvdz0; + u16 rsvdz1; + u16 rsvdz2; + + u16 rsvdz3:14; + u16 device_type:2; + } ioapic; + + /* HV_DEVICE_TYPE_ACPI */ + struct { + u32 input_mapping_base; + u32 input_mapping_count:30; + u32 device_type:2; + } acpi; +} __packed; + #endif -- 2.20.1