Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp199922rwe; Wed, 31 Aug 2022 00:50:35 -0700 (PDT) X-Google-Smtp-Source: AA6agR5DsnU/LCmTpHLisBLHuwH9RWfsK4pvO3LYXQIzOauERe9SfQK1cYI2TK1KK4/DZh4k5VuP X-Received: by 2002:a17:907:31ce:b0:742:1206:529e with SMTP id xf14-20020a17090731ce00b007421206529emr5395664ejb.643.1661932235618; Wed, 31 Aug 2022 00:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661932235; cv=none; d=google.com; s=arc-20160816; b=XBohadr8yuGCBnMoYMtI4uiXQoaUHsH/OiOTgePaJRvNvtLvjHE+OUjm0jQd5ydcH3 pfOp1Q/SzJEBBeRV7MmNhNXePcdx9IdvgZAEsWC4ULUYsp0u2/OEyWi/abpXxuuK10QP 8T0NZ6ECmSTJDcncNF3v3+RC/L7/YjtNY+BHk+qL2vPJ5xvU2/4GzrDDALxdChmbidAl HA7w8iRis8i+SES5/p8MlqilZHCSkKoOmVJ5jtNEmzQXHvermmy0ICWsSGxYNED3puyC FqpAUjvzL2dxNpQHdJI4lnn39yaPvjikqIPkgkTKtLNP5Ei6Y9hm0xnuHWe5oLVXIIbs 7eag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=4RsQd6z989gLy9f7UFUtwh2mDzr3cBc4MWV84ohyBWQ=; b=G/hOhG3J6U+ubJ/z+xn9Qi/O2jueEwmARRkTtz9hcge8TYnRn3fMiugEf2o1BWKuk7 KSW6ve8SCG9YZzWyJtjkNHSG4BWPjO8GfZPbarPXUGWCl7cOcPuXUduzhfTZnTGfQHDr tRrqKEM+GC9LzPDCYqmeTICpo8TwRBhx+nGeaNVb3LUb4MdSDiWjTrZlsl0Uam8SFch0 TxZZL/0zWivQdDbjLxx5+nn95OsPypGHsFgU+AKRtu5nOCTWy9GaFFbVeZWHJepwNAHI tHhXhiI8LPQaXkmEh0GquZfFzBofNNJJul7AMdan0PpLjhIsMk4uAZ3EPZcvvYy3SMq1 sI7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a17090680ce00b0073ddf3ccee9si9612820ejx.308.2022.08.31.00.50.08; Wed, 31 Aug 2022 00:50:35 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230205AbiHaHov (ORCPT + 99 others); Wed, 31 Aug 2022 03:44:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47004 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230199AbiHaHoL (ORCPT ); Wed, 31 Aug 2022 03:44:11 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6AD7BBD286 for ; Wed, 31 Aug 2022 00:43:36 -0700 (PDT) Received: from ptx.hi.pengutronix.de ([2001:67c:670:100:1d::c0]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oTINi-0006fM-OU; Wed, 31 Aug 2022 09:43:26 +0200 Received: from ore by ptx.hi.pengutronix.de with local (Exim 4.92) (envelope-from ) id 1oTINg-0000cV-JU; Wed, 31 Aug 2022 09:43:24 +0200 Date: Wed, 31 Aug 2022 09:43:24 +0200 From: Oleksij Rempel To: Vladimir Oltean Cc: Arun.Ramadoss@microchip.com, andrew@lunn.ch, linux-kernel@vger.kernel.org, UNGLinuxDriver@microchip.com, vivien.didelot@gmail.com, san@skov.dk, linux@armlinux.org.uk, f.fainelli@gmail.com, kuba@kernel.org, edumazet@google.com, pabeni@redhat.com, netdev@vger.kernel.org, Woojung.Huh@microchip.com, davem@davemloft.net Subject: Re: [Patch net-next v2 0/9] net: dsa: microchip: add support for phylink mac config and link up Message-ID: <20220831074324.GD16715@pengutronix.de> References: <20220724092823.24567-1-arun.ramadoss@microchip.com> <20220830065533.GA18106@pengutronix.de> <67690ec6367c9dc6d2df720dcf98e6e332d2105b.camel@microchip.com> <20220830095830.flxd3fw4sqyn425m@skbuf> <20220830160546.GB16715@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220830160546.GB16715@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain User-Agent: Mutt/1.10.1 (2018-07-13) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c0 X-SA-Exim-Mail-From: ore@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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 Tue, Aug 30, 2022 at 06:05:46PM +0200, Oleksij Rempel wrote: > On Tue, Aug 30, 2022 at 12:58:30PM +0300, Vladimir Oltean wrote: > > Hello, > > > > On Tue, Aug 30, 2022 at 08:15:59AM +0000, Arun.Ramadoss@microchip.com wrote: > ... > > > Hi Oleksij, > > > Is this Bug related to fix in > > > https://lore.kernel.org/lkml/20220829105810.577903823@linuxfoundation.org/ > > > . > > > It is observed in ksz8794 switch. I think after applying this bug fix > > > patch it should work. I don't have ksz8 series to test. I ran the > > > regression only for ksz9 series switches. > > > > I find it unlikely that the cited patch will fix a NULL pointer > > dereference in ksz_get_gbit(). But rather, some pointer to a structure > > is NULL, and we then dereference a member located at its offset 0x5, no? > > > > My eyes are on this: > > > > const u8 *bitval = dev->info->xmii_ctrl1; > > > > data8 |= FIELD_PREP(P_GMII_1GBIT_M, bitval[P_GMII_NOT_1GBIT]); > > ~~~~~~~~~~~~~~~~ > > this is coincidentally > > also 5 > > ack. > > > See, looking at the struct ksz_chip_data[] array element for KSZ8873 > > that Oleksij mentions as broken, I do not see xmii_ctrl1 and xmii_ctrl2 > > as being pointers to anything. > > > > [KSZ8830] = { > > .chip_id = KSZ8830_CHIP_ID, > > .dev_name = "KSZ8863/KSZ8873", > > .num_vlans = 16, > > .num_alus = 0, > > .num_statics = 8, > > .cpu_ports = 0x4, /* can be configured as cpu port */ > > .port_cnt = 3, > > .ops = &ksz8_dev_ops, > > .mib_names = ksz88xx_mib_names, > > .mib_cnt = ARRAY_SIZE(ksz88xx_mib_names), > > .reg_mib_cnt = MIB_COUNTER_NUM, > > .regs = ksz8863_regs, > > .masks = ksz8863_masks, > > .shifts = ksz8863_shifts, > > .supports_mii = {false, false, true}, > > .supports_rmii = {false, false, true}, > > .internal_phy = {true, true, false}, > > }, > > > > Should we point them to ksz8795_xmii_ctrl0 and ksz8795_xmii_ctrl1? I don't know. > > Could you find out what these should be set to? > > xmii_ctrl0/1 are missing and it make no sense to add it. > KSZ8873 switch is controlling CPU port MII configuration over global, > not port based register. > > I'll better define separate ops for this chip. Hm, not only KSZ8830/KSZ8863/KSZ8873 are affected. ksz8795 compatible series with defined .xmii_ctrl0/.xmii_ctrl1 are broken too. Because it is writing to the global config register over ksz_pwrite8 function. It means, we are writing to 0xa6 instead of 0x06. And to 0xf6 instead of 0x56. -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |