From: "Mukunda,Vijendar" <vijendar.mukunda@amd.com>
To: Vinod Koul <vkoul@kernel.org>
Cc: alsa-devel@alsa-project.org,
pierre-louis.bossart@linux.intel.com,
Basavaraj.Hiregoudar@amd.com, Sunil-kumar.Dommati@amd.com,
Mario.Limonciello@amd.com, amadeuszx.slawinski@linux.intel.com,
Mastan.Katragadda@amd.com, Arungopal.kondaveeti@amd.com,
claudiu.beznea@microchip.com,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Sanyog Kale <sanyog.r.kale@intel.com>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH V6 5/8] soundwire: amd: add SoundWire manager interrupt handling
Date: Fri, 17 Mar 2023 20:16:36 +0530 [thread overview]
Message-ID: <de3ae97a-50de-8906-d370-e93122e2fb16@amd.com> (raw)
In-Reply-To: <ZBRs5LAXRQ2S1Htc@matsya>
On 17/03/23 19:06, Vinod Koul wrote:
> On 16-03-23, 22:34, Mukunda,Vijendar wrote:
>> On 15/03/23 15:36, Vinod Koul wrote:
>>> On 07-03-23, 19:01, Vijendar Mukunda wrote:
>>>> +static void amd_sdw_update_slave_status_work(struct work_struct *work)
>>>> +{
>>>> + struct amd_sdw_manager *amd_manager =
>>>> + container_of(work, struct amd_sdw_manager, amd_sdw_work);
>>>> + int retry_count = 0;
>>>> +
>>>> + if (amd_manager->status[0] == SDW_SLAVE_ATTACHED) {
>>>> + acp_reg_writel(0, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_0TO7);
>>>> + acp_reg_writel(0, amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_8TO11);
>>>> + }
>>>> +
>>>> +update_status:
>>>> + sdw_handle_slave_status(&amd_manager->bus, amd_manager->status);
>>>> + /*
>>>> + * During the peripheral enumeration sequence, the SoundWire manager interrupts
>>>> + * are masked. Once the device number programming is done for all peripherals,
>>>> + * interrupts will be unmasked. Read the peripheral device status from ping command
>>>> + * and process the response. This sequence will ensure all peripheral devices enumerated
>>>> + * and initialized properly.
>>>> + */
>>>> + if (amd_manager->status[0] == SDW_SLAVE_ATTACHED) {
>>>> + if (retry_count++ < SDW_MAX_DEVICES) {
>>>> + acp_reg_writel(AMD_SDW_IRQ_MASK_0TO7, amd_manager->mmio +
>>>> + ACP_SW_STATE_CHANGE_STATUS_MASK_0TO7);
>>>> + acp_reg_writel(AMD_SDW_IRQ_MASK_8TO11,
>>>> + amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_8TO11);
>>>> + amd_sdw_read_and_process_ping_status(amd_manager);
>>>> + goto update_status;
>>> goto are mostly used for error handling, i dont thing case here deserves
>>> a goto, can you please change this...
>> I agree. goto statements will be used mostly for error handling.
>> But this is a different scenario. We have used goto statement to call sdw_handle_slave_status()
>> from if statement to make sure all peripheral devices are enumerated and initialized properly.
>> Please let us know if you are expecting code to be modified as mentioned below.
>>
>> sdw_handle_slave_status(&amd_manager->bus, amd_manager->status);
>>
>> if (amd_manager->status[0] == SDW_SLAVE_ATTACHED) {
>> acp_reg_writel(AMD_SDW_IRQ_MASK_0TO7, amd_manager->mmio +
>> ACP_SW_STATE_CHANGE_STATUS_MASK_0TO7);
>> acp_reg_writel(AMD_SDW_IRQ_MASK_8TO11,
>> amd_manager->mmio + ACP_SW_STATE_CHANGE_STATUS_MASK_8TO11);
>> amd_sdw_read_and_process_ping_status(amd_manager);
>> sdw_handle_slave_status(&amd_manager->bus, amd_manager->status);
>> }
>>
>> We have to check any race conditions occurs or not if we implement code as mentioned
>> above.
> what race are you talking about
Our intention is to convey that we need to verify the above logic and check
for faulty case handling where status[0] is keep on updated as "ATTACHED"
when multiple peripheral devices are connected over the link.
>
>> IMHO, it is still good to go with goto statement implementation.
> Since you keep checking, essentially this seems to be a loop?
In normal scenario , if condition gets executed once and exits the function.
In faulty case, if status[0] is still reported as ATTACHED, it runs in loop till retry_count
reaches SDW_MAX_DEVICES.
We want to keep checking the status until ping command reports
correct status on all other devices other than "ATTACHED" on device0 in a loop using goto
statement with max retry count.
>
next prev parent reply other threads:[~2023-03-17 14:43 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20230307133135.545952-1-Vijendar.Mukunda@amd.com>
2023-03-07 13:31 ` [PATCH V6 1/8] soundwire: export sdw_compute_slave_ports() function Vijendar Mukunda
2023-03-07 13:31 ` [PATCH V6 2/8] soundwire: amd: Add support for AMD Manager driver Vijendar Mukunda
2023-03-07 15:25 ` Pierre-Louis Bossart
2023-03-07 20:36 ` Mukunda,Vijendar
2023-03-15 9:42 ` Vinod Koul
2023-03-16 13:58 ` Mukunda,Vijendar
2023-03-17 13:34 ` Vinod Koul
2023-03-17 14:04 ` Mukunda,Vijendar
2023-03-07 13:31 ` [PATCH V6 3/8] soundwire: amd: register SoundWire manager dai ops Vijendar Mukunda
2023-03-15 9:58 ` Vinod Koul
2023-03-16 3:32 ` Mukunda,Vijendar
2023-03-07 13:31 ` [PATCH V6 4/8] soundwire: amd: enable build for AMD SoundWire manager driver Vijendar Mukunda
2023-03-15 9:59 ` Vinod Koul
2023-03-16 3:29 ` Mukunda,Vijendar
2023-03-07 13:31 ` [PATCH V6 5/8] soundwire: amd: add SoundWire manager interrupt handling Vijendar Mukunda
2023-03-15 10:06 ` Vinod Koul
2023-03-16 17:04 ` Mukunda,Vijendar
2023-03-17 13:36 ` Vinod Koul
2023-03-17 14:46 ` Mukunda,Vijendar [this message]
2023-03-07 13:31 ` [PATCH V6 6/8] soundwire: amd: add runtime pm ops for AMD SoundWire manager driver Vijendar Mukunda
2023-03-07 13:31 ` [PATCH V6 7/8] soundwire: amd: handle SoundWire wake enable interrupt Vijendar Mukunda
2023-03-07 13:31 ` [PATCH V6 8/8] soundwire: amd: add pm_prepare callback and pm ops support Vijendar Mukunda
2023-03-07 15:28 ` Pierre-Louis Bossart
2023-03-07 20:25 ` Mukunda,Vijendar
2023-03-07 21:08 ` Pierre-Louis Bossart
2023-03-08 4:32 ` Mukunda,Vijendar
2023-03-08 13:58 ` Pierre-Louis Bossart
2023-03-08 14:19 ` Mukunda,Vijendar
2023-03-08 14:23 ` Pierre-Louis Bossart
2023-03-08 15:05 ` Mukunda,Vijendar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=de3ae97a-50de-8906-d370-e93122e2fb16@amd.com \
--to=vijendar.mukunda@amd.com \
--cc=Arungopal.kondaveeti@amd.com \
--cc=Basavaraj.Hiregoudar@amd.com \
--cc=Mario.Limonciello@amd.com \
--cc=Mastan.Katragadda@amd.com \
--cc=Sunil-kumar.Dommati@amd.com \
--cc=alsa-devel@alsa-project.org \
--cc=amadeuszx.slawinski@linux.intel.com \
--cc=claudiu.beznea@microchip.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sanyog.r.kale@intel.com \
--cc=vkoul@kernel.org \
--cc=yung-chuan.liao@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox