Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp9334451rwr; Thu, 11 May 2023 13:23:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4+lBSphKAssDz/neFw48gDBIiaXUadzOtkSq7nORGr/PRBkHmaGmtrCZlxEDPjN5K1luBS X-Received: by 2002:a05:6a20:2593:b0:101:2923:56cd with SMTP id k19-20020a056a20259300b00101292356cdmr14245927pzd.62.1683836622014; Thu, 11 May 2023 13:23:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683836621; cv=none; d=google.com; s=arc-20160816; b=gL1fNFaV1KAuiVRxDvfM97jEDflOGuhF3cf7Vnw1S5ku2m8ZE61suAS5uPIlWsDBYI tEYcCsHtDtUHBe05v6XRYaFcrj12G78M/keUWmiA0+nmd6dK0FlWMIu3M1+VC/LINNK3 JGmj5h3Aq2z4AbsKTVE9Gf08nSvH3Rz7fnE6hXQIX/4+bqLSYs2evcPraCDx9HyQ4Emp ZQUZ+CH4owcxjeepYGByvFfp2yJbolTiXkMeQB7X0A4xebEJ8haJungY4lojEh3wlT+t c6Ey+4r+CVnhzN28QIyRGKu3abYYDxOrzKCiQpjZjUuaqcEIFg65C55ZSdJy8wEcNlI+ QMOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=49+wF3dhiJ5ry2Q356rv8LAmJkXZ30kFszS6vJAnNZs=; b=OfUCbG7i2E/KLqqtU1O1uAVALDieM0wTVuUXSc84l88NipuTug6woGXkOy3rALc9dl C7+KpwH23MyHO5CXxkdhlK/8lfz4PFVv8Ukx02rHrAPbqt6sh+d5clQCfpaq9zS682sW NsD9QzyP3l3RaAxBMzFUt5XhXtmLvt51j9XgpoDUWCEWElev3R/gEV6xwT0kSuw2ng4r 6h54CSaL3MemWyRtoV+pES6fnhXu/QSrFfZbeOQYNM9sy71EiDojMXWrOPscwsZ8j0rY ypAZWA549+nAtG8fGUZ6HnofUUwOA4ZzIwGkzEQt2yQGRWqV5j2oBSDfNt91AOe3qPy+ u1rA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g0LA4OoU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a186-20020a6390c3000000b00502f4be647fsi7891193pge.641.2023.05.11.13.23.29; Thu, 11 May 2023 13:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=g0LA4OoU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239466AbjEKTuq (ORCPT + 99 others); Thu, 11 May 2023 15:50:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239584AbjEKTug (ORCPT ); Thu, 11 May 2023 15:50:36 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C9F93D041; Thu, 11 May 2023 12:50:18 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id a640c23a62f3a-9659f452148so1616556466b.1; Thu, 11 May 2023 12:50:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683834597; x=1686426597; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=49+wF3dhiJ5ry2Q356rv8LAmJkXZ30kFszS6vJAnNZs=; b=g0LA4OoUg3kQOmMAzBOrSwRBOXXIKInTZnHL0lTfR77a7OyJ/NCj4+fk7crY2JRd/5 4YSVadRTFFlwhBIRQfrIx0cxfx6CDFJ7EiPuFtKhkwVU2Xyk9qH+Pq50Z80rMCgZkHMT /VdV7VsTCoPJID8JrTJOPMj6XksVZJLigx9HNpdXlBKIbzQAgPymTETRQC0kwnRKxrVZ tttHHS1qYpUoJgIXUs7ne7JH50GlNC4qcRlfUqfV97K6m197dbKU1yYADReh01GPNlK6 BHinkNX1wMW7X1/tpu8bGP+WdFexL0r2PQyBcDlHlLKsDM6aS+fmFpMefpDAJNCvs1+o E7+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683834597; x=1686426597; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=49+wF3dhiJ5ry2Q356rv8LAmJkXZ30kFszS6vJAnNZs=; b=bjF7HEZu4lqIxPsuv3sOUh8Dw+qz7u7rB+LycCioFTxD0vW8wcywpHcONCp3Yyql2g Jff7ZxSLPcGsuxQPutGtAmjoz28XIXQuKCy9FUD1kc29aEoceivFoM7APjcrsIfJL+vM tsIMmNLzbiQKzE5h9xfm3iPsYI0VLlPJrtQ7P5uJlWIYenSqoilmhopLtkSQ9gQssJFj dKR617AfqHawZ8JJ22NDBirUtXyA2zzGTWiINb7QztHkL1OBNqPIVxosJzbO04iR0npM sc7x5hVWSY48HJlOX2zXfT6j0+IZgWWuBUH9pHYinUODb/oQSfXvPs3wiC6GqVZhgPb+ /2FA== X-Gm-Message-State: AC+VfDx2KRecoUcevOm3XuTC+FyiFFwXgwcCYKESPS/uwA0nkT4XbyhP ds44xghP7ON5HbbQk8a90No= X-Received: by 2002:a17:906:58cd:b0:966:350f:f42d with SMTP id e13-20020a17090658cd00b00966350ff42dmr19047994ejs.23.1683834597092; Thu, 11 May 2023 12:49:57 -0700 (PDT) Received: from ?IPV6:2a01:c23:c58e:b900:c905:524d:7524:40e1? (dynamic-2a01-0c23-c58e-b900-c905-524d-7524-40e1.c23.pool.telefonica.de. [2a01:c23:c58e:b900:c905:524d:7524:40e1]) by smtp.googlemail.com with ESMTPSA id n5-20020a1709065da500b0096616adc0d5sm4432982ejv.104.2023.05.11.12.49.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 11 May 2023 12:49:56 -0700 (PDT) Message-ID: <98b3b70a-86c0-78c0-b734-0764bb5a21fc@gmail.com> Date: Thu, 11 May 2023 21:49:52 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH 14/17] r8169: Use pcie_lnkctl_clear_and_set() for changing LNKCTL To: =?UTF-8?Q?Ilpo_J=c3=a4rvinen?= , linux-pci@vger.kernel.org, Bjorn Helgaas , Rob Herring , Lorenzo Pieralisi , =?UTF-8?Q?Krzysztof_Wilczy=c5=84ski?= , Lukas Wunner , nic_swsd@realtek.com, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230511131441.45704-1-ilpo.jarvinen@linux.intel.com> <20230511131441.45704-15-ilpo.jarvinen@linux.intel.com> Content-Language: en-US From: Heiner Kallweit In-Reply-To: <20230511131441.45704-15-ilpo.jarvinen@linux.intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.05.2023 15:14, Ilpo Järvinen wrote: > Don't assume that only the driver would be accessing LNKCTL. ASPM > policy changes can trigger write to LNKCTL outside of driver's control. > > Use pcie_lnkctl_clear_and_set() which does proper locking to avoid > losing concurrent updates to the register value. > Wouldn't it be more appropriate to add proper locking to the underlying pcie_capability_clear_and_set_word()? > Suggested-by: Lukas Wunner > Signed-off-by: Ilpo Järvinen > --- > drivers/net/ethernet/realtek/r8169_main.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c > index a7e376e7e689..c0294a833681 100644 > --- a/drivers/net/ethernet/realtek/r8169_main.c > +++ b/drivers/net/ethernet/realtek/r8169_main.c > @@ -2686,14 +2686,12 @@ static void __rtl_ephy_init(struct rtl8169_private *tp, > > static void rtl_disable_clock_request(struct rtl8169_private *tp) > { > - pcie_capability_clear_word(tp->pci_dev, PCI_EXP_LNKCTL, > - PCI_EXP_LNKCTL_CLKREQ_EN); > + pcie_lnkctl_clear_and_set(tp->pci_dev, PCI_EXP_LNKCTL_CLKREQ_EN, 0); > } > > static void rtl_enable_clock_request(struct rtl8169_private *tp) > { > - pcie_capability_set_word(tp->pci_dev, PCI_EXP_LNKCTL, > - PCI_EXP_LNKCTL_CLKREQ_EN); > + pcie_lnkctl_clear_and_set(tp->pci_dev, 0, PCI_EXP_LNKCTL_CLKREQ_EN); > } > > static void rtl_pcie_state_l2l3_disable(struct rtl8169_private *tp)