From patchwork Thu Nov 5 16:58:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Liu X-Patchwork-Id: 11884721 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 821A91744 for ; Thu, 5 Nov 2020 16:59:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6205E20759 for ; Thu, 5 Nov 2020 16:59:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604595545; bh=DxhP2xnid7U+jPbjbJJaC29wNGVzvtEJsVPu2DiQbto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sonPNUYkwhzVGPWBOWwzkjkcp2J3tnJJ4gEhRBketejB1evqmB70ku3aI3SvOX0c+ gS7LWCbGUxs5DoICq6jEqsO5oT4ImzUsRkFEhPFqK515TdAdNxOSd/4D7LnDJMJ30y Z5xDa4ahUujYStWprNniVMiaqpdjO9zb9i57QBMI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731759AbgKEQ7A (ORCPT ); Thu, 5 Nov 2020 11:59:00 -0500 Received: from mail-wm1-f68.google.com ([209.85.128.68]:52087 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731770AbgKEQ6e (ORCPT ); Thu, 5 Nov 2020 11:58:34 -0500 Received: by mail-wm1-f68.google.com with SMTP id v5so2294193wmh.1; Thu, 05 Nov 2020 08:58:31 -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=+BzHeqflvebJlsGYwDKpyOjSS1EFn75Ol+muaJJQ0G4=; b=mLrhtHXwAs2MUuzIA1fUX+pu5YRMF80oo1oK6iv+zPFMgy/NvOYuWEdjY4O4hVYbEQ /vc78SDdELFHUi8PYdPtr4yWOkTR0SDLxVwDQE3l4DFWj6Ov+dD8GP4LITq9inEhT+jC fAO9fxoxPmSGe1tSWw+J+3wJ+VYLKVMdxXFwEeu01Ua/7Qub4TP7VWtoVOj4i0steSXc 9Irptx+tfXS/ug5YFF0+YnkHXPcvdr781fbtzDVQOigOYYgSp/qv38D85LOzHVRiRH6/ NnmU69ytedHv/gbYgMlSvSqpmuVtZae7SqB2kbQhtWZ1O9GanQ01F32QY2gzFk9DIhF3 OMlQ== X-Gm-Message-State: AOAM532pvQgKAUzALQCdZptgmGXn+pUumHZxN95E/MW+AJHBwC3cJ6h8 8A2B/MWg9cWzzss+ltrpCh1oCscQw6o= X-Google-Smtp-Source: ABdhPJy6F+pnZnky21/ZEIlZBbedcOZkbXotGhtWHc7LyhPmHs1GtjMDkyOFWAb9y/Jn8xkNSpmNPg== X-Received: by 2002:a1c:5401:: with SMTP id i1mr3757122wmb.124.1604595511072; Thu, 05 Nov 2020 08:58:31 -0800 (PST) Received: from liuwe-devbox-debian-v2.j3c5onc20sse1dnehy4noqpfcg.zx.internal.cloudapp.net ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id z5sm3350729wrw.87.2020.11.05.08.58.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Nov 2020 08:58:30 -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 , Rob Herring , "K. Y. Srinivasan" , Haiyang Zhang , Stephen Hemminger , Lorenzo Pieralisi , 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 v2 12/17] asm-generic/hyperv: update hv_interrupt_entry Date: Thu, 5 Nov 2020 16:58:09 +0000 Message-Id: <20201105165814.29233-13-wei.liu@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20201105165814.29233-1-wei.liu@kernel.org> References: <20201105165814.29233-1-wei.liu@kernel.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pci@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 Acked-by: Rob Herring --- 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 03ed5cb1c4b2..59edc0bf00fe 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -1216,7 +1216,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 86dff6846278..b6895d4d9ad0 100644 --- a/include/asm-generic/hyperv-tlfs.h +++ b/include/asm-generic/hyperv-tlfs.h @@ -480,6 +480,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 { @@ -513,10 +518,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; /*