Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp201062pxb; Wed, 20 Jan 2021 05:05:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4aqCeTe4h1/Uu/GUg7UFxRK3wYJzRdf6WQHfGMmGrkRX/lCUcYgse8iC/mTgyeAHHREWa X-Received: by 2002:a17:906:90c3:: with SMTP id v3mr6155206ejw.461.1611147933136; Wed, 20 Jan 2021 05:05:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611147933; cv=none; d=google.com; s=arc-20160816; b=FypyZDTxDHMjI8Ku7p2aRs1XJGHJpl/qPOwosxfx0ZKbKdiZJAWfEg+kDNd/Vicfrh lCD/+GaSKsmmJQF4nFQkj9ADW9RgQhMx5lF+dw8uM2C5MiXM29kXgWOm9HoYGnUbCYp4 +jspcP0ON7qMrH4cBdCPugsKqZJe8nLJ3SMdmyBl8ypl1AIZ4SXyaSpliT8AxCdLtf+S M4zdn19TwXuX35g/OC7yOb2uK/a2MzTOy3ufAM0uNZXF4JYB3Ww9Ny6mNeU/SSfldXhu YVq46xrXAl50beCNo/lMJ5YuvuFkpkTkCXi1ndlYmpNNQOhxLN+tuc5ThOWwdc1qrH/7 cEXA== 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=dzbOnNxL80u09GJy4iAUunq55MBrhdieUxkDEglInQUJW89inhwdGgVJfM1SSGEfYV cH7vo1FMGntYXCt6CM30jmda7orbPavFtpTKy5M1qKsNBRusSXilADT/OyGdV0A13Xe3 KlLKU7nOIdfq+Qzkd8YdxDvowTvgV2ukb3kSXt+YjS9GOzKQRVCovodTzGzkEEjmlrC/ RjsgjQbi4Yu+7oJcqoqTElTwmKgh7UNwtRkhcbn6djL8nXvFwJ2jPSzrOhJ6C9r/Cz9h Z9BPGaTmzSGFo3Lh7OEjY3XsAhwi/vrLuy5NWzwara8Srmo2tEGx8o4hJj12tvXY2T3W woJg== 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 e18si648257ejk.657.2021.01.20.05.05.06; Wed, 20 Jan 2021 05:05:33 -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 S1733306AbhATNCo (ORCPT + 99 others); Wed, 20 Jan 2021 08:02:44 -0500 Received: from mail-ej1-f48.google.com ([209.85.218.48]:45207 "EHLO mail-ej1-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387423AbhATMNK (ORCPT ); Wed, 20 Jan 2021 07:13:10 -0500 Received: by mail-ej1-f48.google.com with SMTP id ke15so25518785ejc.12; Wed, 20 Jan 2021 04:12:53 -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=FUQCQvWxqgQWQYx8f9yWPxMUXtfJTGZmug1dUrElIHVknht9U/I3LqLytqhvtUiFPf 1wk6QRz66lBdg11GLkgEmQ1ZC21mr85nKqY1T8/SvUdbrMNK1pvONyL6/pA9uw2WwiZc EMY5GBrwi8Qr7znq+RxdevvN+5DZRbz8aH1veWtyOuVPUM60lUr+TKJhXRTyLqOrDK8v +AvNDqSWKM0Rt0hBzH8yA+Cm1KJ66OJ7n/DL64j/1RAkfLvZGlCizPDVEIx359gizLKh 9kYxYJl4IfNBXkGugfPl67RFCM4H4mCbnUWZqEwZAnKN0XvrmNmDC3WjLavelt3tralS zKTA== X-Gm-Message-State: AOAM5303S0JT/69xjRXZNJPPgbPJVxh8fUJ8gnknxPj9AWvxvqwhbmr0 gbiO83wsqQ5FKbxN+KrgB0PO8uB2K8E= X-Received: by 2002:a5d:6983:: with SMTP id g3mr9082864wru.168.1611144076449; Wed, 20 Jan 2021 04:01:16 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id x17sm3747671wro.40.2021.01.20.04.01.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jan 2021 04:01:16 -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 , pasha.tatashin@soleen.com, 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 v5 13/16] asm-generic/hyperv: introduce hv_device_id and auxiliary structures Date: Wed, 20 Jan 2021 12:00:55 +0000 Message-Id: <20210120120058.29138-14-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20210120120058.29138-1-wei.liu@kernel.org> References: <20210120120058.29138-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