Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp818083iob; Fri, 13 May 2022 13:29:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyqdLYGzKGr7JpPIblJezFh0VpW3Lt/ffQQVkX3P/gqrSopc69RPHr2iVzkCuugJv0DJ8sC X-Received: by 2002:a05:600c:4f52:b0:394:61af:a168 with SMTP id m18-20020a05600c4f5200b0039461afa168mr16693139wmq.114.1652473769100; Fri, 13 May 2022 13:29:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652473769; cv=none; d=google.com; s=arc-20160816; b=vS+jXj4i4j0UTXkrOCSfGf0w9myCLrqAfxHkj3WrbDudAaq2FyAu2aNaXj31RgPRBf Sgq/0T39K62bvBgCku7UlhDqcz4Edc5lsJYg2JVGl/pQOSKDKhgimeg45Gu6z+zCFhHP vQUYZDoQuj/qVDV5GJjVx2hnI+mr0vKKc70UtWghZu+OcSo9NYVmqHD+gmJF8VUe5bT4 OSyg+zAOmI6R+vOnNB/26z/dhUCvDTTIgPet5N9zsgUR8UtHE1f78hBJUhVe73UYk82D j7er1fJImFGoe2M7HSYMIwXFMxkRAmX6Ssp0kSOz5D6XOQzna6GIjHrpdKx2Ke09oNm1 46Vg== 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 :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=qppk/eycRG8UmCYQVIByFr5dV8L34E8F44pWDD/iM7Y=; b=U5gzOdhhG5UbqvAVflb89FkN21WrdXEIVawvIKJz393Nx7HdeOESwQDcmm1OxRwJl+ 3LV99SOdAjYkwLIZUb3cGIkOwHES4Z0Ebar+tdE3VnjINYcHGdv3zXBmgLX0A7Gf3m0Q lSWQpx+SA4hMT2iWaAXlrUNKdw7eV/Q3BeBy9b2FjEInnUsgqbvbQV9ws0vNXWEwLLLK 5YESMmwS1THyyNhXekvtEHoJ8HyxfcIDJcjOyA+8EmkTByhsJmC8AdVVIAqmKTLm9j6l Dl2AMoEMvDY5sX/wVNiKS6MsFIK18kcCJZZ4Nk+T/HvekiQpBSdLMRuN/xcZwt1g/yND PRDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=Qw6+ozlF; dkim=neutral (no key) header.i=@suse.de; 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=NONE dis=NONE) header.from=suse.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i9-20020a05600c050900b0038ca34ef1cfsi6042616wmc.126.2022.05.13.13.29.01; Fri, 13 May 2022 13:29:29 -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=@suse.de header.s=susede2_rsa header.b=Qw6+ozlF; dkim=neutral (no key) header.i=@suse.de; 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=NONE dis=NONE) header.from=suse.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350604AbiELHAV (ORCPT + 99 others); Thu, 12 May 2022 03:00:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240098AbiELHAU (ORCPT ); Thu, 12 May 2022 03:00:20 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C32CB4A3FF; Thu, 12 May 2022 00:00:17 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 825EA1F91B; Thu, 12 May 2022 07:00:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1652338816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qppk/eycRG8UmCYQVIByFr5dV8L34E8F44pWDD/iM7Y=; b=Qw6+ozlFIQ/cD2ayEv1gDY60xV7NqRh+P7G3l7lpXtryWI5ywu1/0CF9Gsxrxz31eNGh6D pmKC+8Q/EAdC0sfUuNWCH8AkRkuJqcRlIqzhXwKoXjQ1o2wE4hdRGjaswG3mJCFeN3I0HR HqFG3JWCFCt2KmDQ6Iq4+7MfrURQ9uA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1652338816; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=qppk/eycRG8UmCYQVIByFr5dV8L34E8F44pWDD/iM7Y=; b=CnWF3XAM029nSzPha0PHofmionce+xos7vCSDRLdY50+Taid0KvXDXgtbfRdhJCJr66C/0 zVPDuqrt4+JBp5Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3E3E313A97; Thu, 12 May 2022 07:00:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id imaWDoCwfGILWwAAMHmgww (envelope-from ); Thu, 12 May 2022 07:00:16 +0000 Message-ID: <12c73812-c544-5859-3fc0-38b65785f987@suse.de> Date: Thu, 12 May 2022 09:00:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v3 14/23] ata: libahci: Discard redundant force_port_map parameter Content-Language: en-US To: Serge Semin , Damien Le Moal , Hans de Goede , Jens Axboe Cc: Serge Semin , Alexey Malahov , Pavel Parkhomenko , Rob Herring , linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org References: <20220511231810.4928-1-Sergey.Semin@baikalelectronics.ru> <20220511231810.4928-15-Sergey.Semin@baikalelectronics.ru> From: Hannes Reinecke In-Reply-To: <20220511231810.4928-15-Sergey.Semin@baikalelectronics.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 5/12/22 01:18, Serge Semin wrote: > Currently there are four port-map-related fields declared in the > ahci_host_priv structure and used to setup the HBA ports mapping. First > the ports-mapping is read from the PI register and immediately stored in > the saved_port_map field. If forced_port_map is initialized with non-zero > value then its value will have greater priority over the value read from > PI, thus it will override the saved_port_map field. That value will be > then masked by a non-zero mask_port_map field and after some sanity checks > it will be stored in the ahci_host_priv.port_map field as a final port > mapping. > > As you can see the logic is a bit too complicated for such a simple task. > We can freely get rid from at least one of the fields with no change to > the implemented semantic. The force_port_map field can be replaced with > taking non-zero saved_port_map value into account. So if saved_port_map is > pre-initialized by the low level drivers (platform drivers) then it will > have greater priority over the value read from PI register and will be > used as actual HBA ports mapping later on. Thus the ports map forcing task > will be just transferred from the force_port_map to saved_port_map field. > > This modification will perfectly fit into the feature of having OF-based > initialization of the HW-init HBA CSR fields we are about to introduce in > the next commit. > > Signed-off-by: Serge Semin > --- > drivers/ata/ahci.c | 2 +- > drivers/ata/ahci.h | 1 - > drivers/ata/libahci.c | 10 ++++++---- > drivers/ata/libahci_platform.c | 2 +- > 4 files changed, 8 insertions(+), 7 deletions(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer