From patchwork Wed Apr 15 16:59:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 6222341 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC4B4BF4A6 for ; Wed, 15 Apr 2015 18:06:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED78720148 for ; Wed, 15 Apr 2015 18:06:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 32B1F202E9 for ; Wed, 15 Apr 2015 18:06:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932945AbbDOSGB (ORCPT ); Wed, 15 Apr 2015 14:06:01 -0400 Received: from mail-pa0-f52.google.com ([209.85.220.52]:34325 "EHLO mail-pa0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932905AbbDOSFx (ORCPT ); Wed, 15 Apr 2015 14:05:53 -0400 Received: by pacyx8 with SMTP id yx8so58996310pac.1 for ; Wed, 15 Apr 2015 11:05:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-type:content-transfer-encoding; bh=l4NHeQIaNtqco9pSzZ4me7R5WJr0uDxh14qLkWLXWIc=; b=WDohhN5Spywwit/MeJ2ImbxzFvPhZ5GC85AsoRGPpuGwotSUZShIO65IYE4rXp91YO kzC3u0n5ZZJKxLdRuNrwqZzhDpcrAI7UX1tcU0Q0pha9uF2mnKFP7fVSF7UDUh1tRJV2 2vxBA2adYa8mVCNC/3UYOOyVQ1/1GonGOvKRfAvPTPOKPO8udcF4NckdZdEZj3rTj/3m uncumWpD9xAs2sOIZGqYKN4RmaEJkEgvEtYjkVcEukACQ9hEfoyztc1Bf4NNZRwM1vwM XVg9TkeFURyQQRIosGkxO5KW5Qg2ZCPxp9ajkBqg0/NmkWeNMkjSNLLA5GvkSvRLzIFA d3Vg== X-Gm-Message-State: ALoCoQkkJqnVvv8u8W/6J1wnu1ntl04RWvayofbeTBqpu8txuL70p7OwXFTVFsO4jd0h+pmjmx87 X-Received: by 10.66.136.17 with SMTP id pw17mr49216588pab.33.1429121152959; Wed, 15 Apr 2015 11:05:52 -0700 (PDT) Received: from urahara (static-50-53-82-155.bvtn.or.frontiernet.net. [50.53.82.155]) by mx.google.com with ESMTPSA id pb2sm4783623pdb.33.2015.04.15.11.05.51 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Apr 2015 11:05:52 -0700 (PDT) Date: Wed, 15 Apr 2015 09:59:34 -0700 From: Stephen Hemminger To: "Michael S. Tsirkin" , "Hans J. Koch" , Greg Kroah-Hartman Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] uio: add irq control support to uio_pci_generic Message-ID: <20150415095934.09966367@urahara> MIME-Version: 1.0 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The driver already supported INTX interrupts but had no in kernel function to enable and disable them. It is possible for userspace to do this by accessing PCI config directly, but this racy and better handled by same mechanism that already exists in kernel. Signed-off-by: Stephen Hemminger --- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html --- a/drivers/uio/uio_pci_generic.c 2015-04-15 08:50:15.543900681 -0700 +++ b/drivers/uio/uio_pci_generic.c 2015-04-15 09:00:01.658609786 -0700 @@ -53,6 +53,18 @@ static irqreturn_t irqhandler(int irq, s return IRQ_HANDLED; } +static int irqcontrol(struct uio_info *info, s32 irq_on) +{ + struct uio_pci_generic_dev *gdev = to_uio_pci_generic_dev(info); + struct pci_dev *pdev = gdev->pdev; + + pci_cfg_access_lock(pdev); + pci_intx(pdev, irq_on); + pci_cfg_access_unlock(pdev); + + return 0; +} + static int probe(struct pci_dev *pdev, const struct pci_device_id *id) { @@ -89,6 +101,7 @@ static int probe(struct pci_dev *pdev, gdev->info.irq = pdev->irq; gdev->info.irq_flags = IRQF_SHARED; gdev->info.handler = irqhandler; + gdev->info.irqcontrol = irqcontrol; gdev->pdev = pdev; err = uio_register_device(&pdev->dev, &gdev->info);