From patchwork Thu Jun 22 13:21:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QsO2c3rDtnJtw6lueWkgWm9sdMOhbg==?= X-Patchwork-Id: 779519 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3wtj1y70jhz9s3s for ; Thu, 22 Jun 2017 23:23:02 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=pr.hu header.i=@pr.hu header.b="dWhNRl5Q"; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752098AbdFVNWs (ORCPT ); Thu, 22 Jun 2017 09:22:48 -0400 Received: from mail7.pr.hu ([87.242.0.7]:55135 "EHLO mail7.pr.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751835AbdFVNWL (ORCPT ); Thu, 22 Jun 2017 09:22:11 -0400 Received: from [2a02:808:3:101::5] (helo=mail.pr.hu) by frontdoor.pr.hu with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1dO23g-0005Hc-Gw; Thu, 22 Jun 2017 15:22:04 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=pr.hu; s=pr20170203; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=0H5xR9V3heeW7ZX2ofYgtGUDhRqzUqZKvoIOPVIGHnk=; b=dWhNRl5QUheHjU0Y3VaoW4OSHHnXA/rlA1csNZSKioXT1ib0kRF1d/yg21FjVZV2jz42M/06/oFD/Rd6YS+oeZsFN1jxe/nE+2kVL2vfjzv5sEgxs8eUEihJLjvLEc3LZZ1dNoC3mKAC115jF9DcO4MZRpWZB95u/b9GhsLTqwHaSBlLUIKNz5UCpFK2f+wxsZV9eSDTiesESYro0eXsU3y1rzsA/9ElAjnLnsOJTXjSNHsKEZ6PqkUTsADU/Pgv90iqGpSrkKlriHFow/fqfUHa5Zq8/qjl9ve9hb53yeY2bq2P5/dICGCmsFgNTBhLr6N7ubEyv56Oo+ah6Av3oQ==; Received: from host-87-242-51-16.prtelecom.hu ([87.242.51.16] helo=s002.sicom.com) by mail.pr.hu with esmtpa (Exim 4.80) (envelope-from ) id 1dO23Z-0000Fg-5R; Thu, 22 Jun 2017 15:22:02 +0200 From: =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= To: linux-kernel@vger.kernel.org Cc: linux-usb@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-i2c@vger.kernel.org, Paul Menzel , Christian Fetzer , Jean Delvare , Nehal Shah , Tim Small , Guenter Roeck , kernel@ekass.net, wim@iguana.be, jlayton@poochiereds.net, marc.2377@gmail.com, cshorler@googlemail.com, wsa@the-dreams.de, regressions@leemhuis.info, =?UTF-8?q?Zolt=C3=A1n=20B=C3=B6sz=C3=B6rm=C3=A9nyi?= Subject: [PATCH 3/5 v4] usb: pci-quirks: Protect the I/O port pair of SB800 Date: Thu, 22 Jun 2017 15:21:32 +0200 Message-Id: <20170622132134.7200-4-zboszor@pr.hu> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170622132134.7200-1-zboszor@pr.hu> References: <20170621035349.4125-1-zboszor@pr.hu> <20170622132134.7200-1-zboszor@pr.hu> MIME-Version: 1.0 X-Spam-Score: 2.2 (++) X-Spam-Report: Spam detection software, running on the system "prspamd3.pr.hu", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: This patch uses the previously introduced macro called request_declared_muxed_region() to synchronize access to the I/O port pair 0xcd6 / 0xcd7 on SB800. These I/O ports are also used by i2c-piix4 and sp5100_tco, so synchronization is necessary. The other drivers will also be modified to use the new macro in subsequest patched. [...] Content analysis details: (2.2 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.2 ALL_TRUSTED Passed through trusted hosts only via SMTP 3.5 BAYES_99 BODY: Bayes spam probability is 99 to 100% [score: 1.0000] 0.2 BAYES_999 BODY: Bayes spam probability is 99.9 to 100% [score: 1.0000] -1.3 AWL AWL: Adjusted score from AWL reputation of From: address X-Scan-Signature: 3473fb74e7ad808e6fbe21f69ada951e X-Spam-Tracer: backend.mail.pr.hu 2.2 20170622132202Z Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org This patch uses the previously introduced macro called request_declared_muxed_region() to synchronize access to the I/O port pair 0xcd6 / 0xcd7 on SB800. These I/O ports are also used by i2c-piix4 and sp5100_tco, so synchronization is necessary. The other drivers will also be modified to use the new macro in subsequest patched. v1: Started with a common mutex in a C source file. v2: Declared the common mutex in drivers/usb/host/pci-quirks.c instead of in a common C file. v3: Switched to using the new request_declared_muxed_region macro. v4: Fixed checkpatch.pl warnings and use the new release_declared_region() macro. Signed-off-by: Zoltán Böszörményi --- drivers/usb/host/pci-quirks.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c index a9a1e4c..593942a 100644 --- a/drivers/usb/host/pci-quirks.c +++ b/drivers/usb/host/pci-quirks.c @@ -279,6 +279,8 @@ bool usb_amd_prefetch_quirk(void) } EXPORT_SYMBOL_GPL(usb_amd_prefetch_quirk); +static struct resource sb800_res = DEFINE_RES_IO_NAMED(0xcd6, 2, "SB800 USB"); + /* * The hardware normally enables the A-link power management feature, which * lets the system lower the power consumption in idle states. @@ -314,11 +316,13 @@ static void usb_amd_quirk_pll(int disable) if (amd_chipset.sb_type.gen == AMD_CHIPSET_SB800 || amd_chipset.sb_type.gen == AMD_CHIPSET_HUDSON2 || amd_chipset.sb_type.gen == AMD_CHIPSET_BOLTON) { + request_declared_muxed_region(&sb800_res); outb_p(AB_REG_BAR_LOW, 0xcd6); addr_low = inb_p(0xcd7); outb_p(AB_REG_BAR_HIGH, 0xcd6); addr_high = inb_p(0xcd7); addr = addr_high << 8 | addr_low; + release_declared_region(&sb800_res); outl_p(0x30, AB_INDX(addr)); outl_p(0x40, AB_DATA(addr));