From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-14.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 739CFC433E2 for ; Mon, 14 Sep 2020 17:44:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37BBA20759 for ; Mon, 14 Sep 2020 17:44:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600105459; bh=obSjriyhvhgsTesoxIPtp9TJ3vD1c+NGYIc6e+/TvrU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=KTV+XwGKj0/lXKvlQMRrs2eGfyKcnRJrQICbwLtoFWwc+o1BZxyxPL692mdPNKAae 1amxV1lQCRxs82nGigrWg+iGERZ4yGl0XShc1xNoeJzKTFmd5CMKBfbCKYd2ZcCLge yxcY8IqWU41gXZXcToMAC4S4KWKdqD9CUYSmieTY= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725992AbgINRoP (ORCPT ); Mon, 14 Sep 2020 13:44:15 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:34167 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726081AbgINMFm (ORCPT ); Mon, 14 Sep 2020 08:05:42 -0400 Received: by mail-ed1-f65.google.com with SMTP id k14so1378055edo.1; Mon, 14 Sep 2020 05:04:13 -0700 (PDT) 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=lt7oJ0RYkp7GOEh6jTuKHSPMhemyBNu8hytTPWvgNCo=; b=lqeoMTZYZ4zIeHG8LVZcFF9rMMzJLajFDX7zt6SNPOIo55+obfbLOsqILmJHc/pSGm I6PxSRY9SuodV/AvUap2WTqwdP5iEgtPXFLAWEyDwwzQjuldrE1oNusSfI+p3XCubgUI v430O/zIWSQX6nQoDPB8vT4Rima0g648FUHFo98W+3z/A7I1HQj8TUlDP3F190A2rhEG ngPeh3he24uGSE1Jy/ofwmpyK7cXoez7UwfZX8qvfs3RVsQOEDm64CFG2MEv4tALqrhN 3Tdcgq44H52WDJ9RcqqRaB3sBD5jWTIs3Tw/iSIczEI116KobX1+jNH6/Fc0IKE3y9GV lGyQ== X-Gm-Message-State: AOAM532jOQaAZYN/JELkdntk4lP7tH1kAHxxBEyMtnzmf5vMsQlQEMD3 iyDTZJdnOCPYzwnosjQq7FMDM617SVk= X-Google-Smtp-Source: ABdhPJzbvIbAfLdh+pFghaYzDSsWI0Hfx/m0A44A95Dhb1oNGzFvSLAWCzgQL/qblUPvk8qT4FL0Xw== X-Received: by 2002:adf:ed12:: with SMTP id a18mr16432588wro.178.1600084778613; Mon, 14 Sep 2020 04:59:38 -0700 (PDT) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id c205sm18764809wmd.33.2020.09.14.04.59.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Sep 2020 04:59:38 -0700 (PDT) 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 , Lorenzo Pieralisi , Rob Herring , Bjorn Helgaas , Arnd Bergmann , linux-pci@vger.kernel.org (open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS), linux-arch@vger.kernel.org (open list:GENERIC INCLUDE/ASM HEADER FILES) Subject: [PATCH RFC v1 12/18] asm-generic/hyperv: update hv_interrupt_entry Date: Mon, 14 Sep 2020 11:59:21 +0000 Message-Id: <20200914115928.83184-4-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200914112802.80611-1-wei.liu@kernel.org> References: <20200914112802.80611-1-wei.liu@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-hyperv-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hyperv@vger.kernel.org We will soon use the same structure to handle IO-APIC interrupts as well. Introduce an enum to identify the source and a data structure for IO-APIC RTE. While at it, update pci-hyperv.c to use the enum. No functional change. Signed-off-by: Wei Liu --- drivers/pci/controller/pci-hyperv.c | 2 +- include/asm-generic/hyperv-tlfs.h | 36 +++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index bf40ff09c99d..b38faa04234b 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1215,7 +1215,7 @@ static void hv_irq_unmask(struct irq_data *data) params = &hbus->retarget_msi_interrupt_params; memset(params, 0, sizeof(*params)); params->partition_id = HV_PARTITION_ID_SELF; - params->int_entry.source = 1; /* MSI(-X) */ + params->int_entry.source = HV_INTERRUPT_SOURCE_MSI; hv_set_msi_entry_from_desc(¶ms->int_entry.msi_entry, msi_desc); params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | (hbus->hdev->dev_instance.b[4] << 16) | diff --git a/include/asm-generic/hyperv-tlfs.h b/include/asm-generic/hyperv-tlfs.h index e7e80a27777b..83945ada5a50 100644 --- a/include/asm-generic/hyperv-tlfs.h +++ b/include/asm-generic/hyperv-tlfs.h @@ -469,6 +469,11 @@ struct hv_create_vp { u64 flags; }; +enum hv_interrupt_source { + HV_INTERRUPT_SOURCE_MSI = 1, /* MSI and MSI-X */ + HV_INTERRUPT_SOURCE_IOAPIC, +}; + union hv_msi_address_register { u32 as_uint32; struct { @@ -502,10 +507,37 @@ union hv_msi_entry { } __packed; }; +union hv_ioapic_rte { + u64 as_uint64; + + struct { + u32 vector:8; + u32 delivery_mode:3; + u32 destination_mode:1; + u32 delivery_status:1; + u32 interrupt_polarity:1; + u32 remote_irr:1; + u32 trigger_mode:1; + u32 interrupt_mask:1; + u32 reserved1:15; + + u32 reserved2:24; + u32 destination_id:8; + }; + + struct { + u32 low_uint32; + u32 high_uint32; + }; +} __packed; + struct hv_interrupt_entry { - u32 source; /* 1 for MSI(-X) */ + u32 source; u32 reserved1; - union hv_msi_entry msi_entry; + union { + union hv_msi_entry msi_entry; + union hv_ioapic_rte ioapic_rte; + }; } __packed; /* -- 2.20.1