From patchwork Mon Jul 17 14:27:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 9845313 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DD08E6037F for ; Mon, 17 Jul 2017 14:32:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CF9A3284FF for ; Mon, 17 Jul 2017 14:32:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C310428540; Mon, 17 Jul 2017 14:32:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4262428540 for ; Mon, 17 Jul 2017 14:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4FC3QakXS7WEKOpIxPJDXMoS+kzTNRuwMlfrgUqIrnc=; b=EpyojPQuft/32Hzhk3N4da6sN9 h+1GSiwPU9J7+djoUTftFEe658xqV3fSQTza7qNNOSGTPIjDReuZdc63pHqwh1eApJtp/P08X6VAS Lc0IOkGBNb/sJRGpC8PShkgTLBZDtj6dR0xLQ1BDg8910O+AF11z90ULOHF0MhcPg5rr+Q7zUy5y0 fJTjcxotwALxTbEiVHXJAMFXqEPck2zfu6PzSjmsj1KxWBgcQeshl0fHve4jCCvqJ/g/CWqyC0ujz sbgwsS+mQyLAr4pCczkAaG1EsvqLqT4uaGxMiM0nNqTxl+sKEiARgKiAZJmmgoZky3ui71Pg8TB8T acjRGDeA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dX74K-0006mo-2u; Mon, 17 Jul 2017 14:32:16 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dX709-0001MO-Kf for linux-arm-kernel@lists.infradead.org; Mon, 17 Jul 2017 14:28:11 +0000 Received: by mail-wm0-x236.google.com with SMTP id 70so22754895wmo.1 for ; Mon, 17 Jul 2017 07:27:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=mQ9H50U30Tjo9VRSZPZDfhhZ6oWQDIua8nK3D2KsB8U=; b=HWu0ClIyP/0LgnRq4MjLTTYBK2nAubcuWfdAo2ETnskBWkx6oc84qyXYg8FWDrzBSW Q5DUsECZ5DELgLq8qvuqJ45OXt55z6ZYAs3KKrraJNUJRVoAc2MkP6Xz7jDudtzx07gx xK/bN72yQmBBzUpbWqamgXmFDUt8jy0Tgdr50= 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; bh=mQ9H50U30Tjo9VRSZPZDfhhZ6oWQDIua8nK3D2KsB8U=; b=SQBiggdKolVG252Wxp2Jam9xIBO10vRKfbAehEQQYHNvFDhEkE/nrQFgplqRhz9ktT DJcWiOcwXL5NJ9t3cQ4/PibP0ydyjB+XY08LdzFpUPUgRslYelN484x9WwvOjGqfneeO T/xn2ADLIx7pubN1rWsdT6XbuLefP+QfMXPZ+Sja9a4n/Y5rvTLpiZTCz986jJ4CqUDt h8Jmpxs30jPBrzCqBMk6UagQIgqfsnzcWaTHbutkDnEdsU4sy2OvlqZoijk/WlD/q7Cy 87t+X0eUaRJKleFtBhJVlzNu1Gx6II+gGCR274LHNS7uZXLXLam7dzwfmJd8V0vB82u1 ClQQ== X-Gm-Message-State: AIVw110bPfHwz0VOxdxBOIHvLVxLjuAuHw29UQXyYSdUHSRr2l1+aRcn n5+63bC5S2hmd+j3AJxLvA== X-Received: by 10.80.169.193 with SMTP id n59mr17494032edc.88.1500301655717; Mon, 17 Jul 2017 07:27:35 -0700 (PDT) Received: from localhost.localdomain (xd93ddc2d.cust.hiper.dk. [217.61.220.45]) by smtp.gmail.com with ESMTPSA id b30sm9428952edd.6.2017.07.17.07.27.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Jul 2017 07:27:35 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [RFC PATCH v2 11/19] genirq: Document vcpu_info usage for per-CPU interrupts Date: Mon, 17 Jul 2017 16:27:10 +0200 Message-Id: <20170717142718.13853-12-cdall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170717142718.13853-1-cdall@linaro.org> References: <20170717142718.13853-1-cdall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170717_072758_930132_BBA19A55 X-CRM114-Status: GOOD ( 12.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , Thomas Gleixner , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP It is currently unclear how to set the VCPU affinity for an interrupt which is of the per-CPU kind, since the Linux irq_data structure describes the state for multiple interrupts when the interrupt is a per-CPU interrupt, one for each physical CPU on the system. Since each such interrupt can be associated with different VCPUs or none at all, associating a single VCPU state with such an interrupt does not capture the necessary semantics. The implementers of irq_set_affinity are the Intel and AMD IOMMUs, and the ARM GIC irqchip. The Intel and AMD callers do not appear to use per-CPU interrupts, and the ARM GIC implementation only checks the pointer against NULL vs. non-NULL. Therefore, simply update the function documentation to explain the expected use in the context of per-CPU interrupts, allowing future changes or additions to irqchip implementers to do the right thing. This allows us to set the VCPU affinity for the virtual timer interrupt in KVM/ARM, which is a per-CPU (PPI) interrupt. Cc: Thomas Gleixner Cc: Marc Zyngier Signed-off-by: Christoffer Dall --- kernel/irq/manage.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 5624b2d..050b9f6 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -381,7 +381,8 @@ int irq_select_affinity_usr(unsigned int irq) /** * irq_set_vcpu_affinity - Set vcpu affinity for the interrupt * @irq: interrupt number to set affinity - * @vcpu_info: vCPU specific data + * @vcpu_info: vCPU specific data or pointer to a percpu array of vCPU + * specific data for per-CPU interrupts * * This function uses the vCPU specific data to set the vCPU * affinity for an irq. The vCPU specific data is passed from