mailbox: pcc: export the PCC subspace type
Subsystems (5)
Huisong Li
maintainerPATCH 1/1 mailbox: pcc: export the PCC subspace type
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
--- drivers/mailbox/pcc.c | 10 ++++------ include/acpi/pcc.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/mailbox/pcc.c +4 -6
@@ -91,7 +91,6 @@ struct pcc_chan_reg {* @cmd_update: PCC register bundle for the command complete update register * @error: PCC register bundle for the error status register * @plat_irq: platform interrupt -* @type: PCC subspace type * @plat_irq_flags: platform interrupt flags * @chan_in_use: this flag is used just to check if the interrupt needs * handling when it is shared. Since only one transfer can occur
@@ -108,7 +107,6 @@ struct pcc_chan_info {struct pcc_chan_reg cmd_update;struct pcc_chan_reg error;int plat_irq; -u8 type;unsigned int plat_irq_flags;bool chan_in_use; };
@@ -263,7 +261,7 @@ static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan)* bit 0 indicates that Platform is sending a notification and OSPM * needs to respond this interrupt to process this command. */ -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE ) +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE )return !val;return !!val;
@@ -284,7 +282,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)int ret; pchan = chan->con_priv; -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && !pchan->chan_in_use)return IRQ_NONE ;
@@ -312,7 +310,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)* * The PCC master subspace channel clears chan_in_use to free channel. */ -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE ) +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE )pcc_send_data (chan,NULL ); pchan->chan_in_use = false;
@@ -766,7 +764,7 @@ static int pcc_mbox_probe(struct platform_device *pdev)pcc_parse_subspace_shmem (pchan, pcct_entry); - pchan->type = pcct_entry->type; + pchan->chan.type = pcct_entry->type; pcct_entry = (struct acpi_subtable_header *) ((unsigned long ) pcct_entry + pcct_entry->length); }
include/acpi/pcc.h +1 -0
@@ -16,6 +16,7 @@ struct pcc_mbox_chan {u32 latency;u32 max_access_rate;u16 min_turnaround_time; +u8 type; };#define MAX_PCC_SUBSPACES 256
Signature · 1 line
2.33.0
Quoted 7 lines · Huisong Li
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
I would prefer to avoid this, but please post it with user to get better understanding of it.
Signature · 2 lines
Regards, Sudeep
lihuisong (C)
maintainerQuoted 10 lines · Sudeep Holla
Quoted 7 lines · Huisong Li
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
I would prefer to avoid this, but please post it with user to get better understanding of it.
Hi Sudeep,
Thanks for your fast review.
Sorry, I cannot fully understand what you mean. What should I do for it?
Currently, it seems that the subspace type in all drivers used PCC is fixed and not obtained from their platform. IMO, PCCT is a best natural way to export it.
/Huisong
Quoted 12 lines · lihuisong (C)
Quoted 10 lines · Sudeep Holla
Quoted 7 lines · Huisong Li
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
I would prefer to avoid this, but please post it with user to get better understanding of it.
Quoted 8 lines
Hi Sudeep,
Thanks for your fast review.
Sorry, I cannot fully understand what you mean. What should I do for it? Currently, it seems that the subspace type in all drivers used PCC is fixed and not obtained from their platform.
IMO, PCCT is a best natural way to export it.
OK, but please post the changes in the *driver* you ought to use this channel type. Your change just allows the drivers to use it but it doesn't contain any driver making use of it. So please post that change as well to understand the issue better. It helps in the review.
Signature · 2 lines
Regards, Sudeep
lihuisong (C)
maintainerQuoted 20 lines · Sudeep Holla
Quoted 11 lines · lihuisong (C)
Quoted 10 lines · Sudeep Holla
Quoted 7 lines · Huisong Li
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
I would prefer to avoid this, but please post it with user to get better understanding of it.
Quoted 8 lines
Hi Sudeep,
Thanks for your fast review.
Sorry, I cannot fully understand what you mean. What should I do for it? Currently, it seems that the subspace type in all drivers used PCC is fixed and not obtained from their platform.
IMO, PCCT is a best natural way to export it.
Quoted 4 lines
OK, but please post the changes in the *driver* you ought to use this channel type. Your change just allows the drivers to use it but it doesn't contain any driver making use of it. So please post that change as well to understand the issue better. It helps in the review.
All right, I will post it ASAP.
Quoted 1 line
Huisong Li
maintainerv2 cover mailbox: pcc: export the PCC subspace type
In reply to Huisong LiCurrently, it seems that the subspace type in all drivers used PCC is fixed and not obtained from their platform.
And PCCT is a best natural way to export it.
v1->v2:
- add one patch to use PCC subspace type in kunpeng_hccs
Huisong Li (2):
mailbox: pcc: export the PCC subspace type
soc: kunpeng_hccs: add the check for PCC subspace type
drivers/mailbox/pcc.c | 10 ++++------ drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ include/acpi/pcc.h | 1 + 3 files changed, 22 insertions(+), 6 deletions(-)
Signature · 1 line
2.33.0
Huisong Li
maintainerPATCH v2 1/2 mailbox: pcc: export the PCC subspace type
As stated in APCI spec, the size of the subspace shared memory region may be different for different types. So it is useful for driver to fill PCC communication space. But the driver used this PCC channel doesn't know what is the subspace type of the channel.
So export the PCC subspace type by requesting PCC channel.
--- drivers/mailbox/pcc.c | 10 ++++------ include/acpi/pcc.h | 1 + 2 files changed, 5 insertions(+), 6 deletions(-)
drivers/mailbox/pcc.c +4 -6
@@ -91,7 +91,6 @@ struct pcc_chan_reg {* @cmd_update: PCC register bundle for the command complete update register * @error: PCC register bundle for the error status register * @plat_irq: platform interrupt -* @type: PCC subspace type * @plat_irq_flags: platform interrupt flags * @chan_in_use: this flag is used just to check if the interrupt needs * handling when it is shared. Since only one transfer can occur
@@ -108,7 +107,6 @@ struct pcc_chan_info {struct pcc_chan_reg cmd_update;struct pcc_chan_reg error;int plat_irq; -u8 type;unsigned int plat_irq_flags;bool chan_in_use; };
@@ -263,7 +261,7 @@ static bool pcc_mbox_cmd_complete_check(struct pcc_chan_info *pchan)* bit 0 indicates that Platform is sending a notification and OSPM * needs to respond this interrupt to process this command. */ -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE ) +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE )return !val;return !!val;
@@ -284,7 +282,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)int ret; pchan = chan->con_priv; -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE && !pchan->chan_in_use)return IRQ_NONE ;
@@ -312,7 +310,7 @@ static irqreturn_t pcc_mbox_irq(int irq, void *p)* * The PCC master subspace channel clears chan_in_use to free channel. */ -if (pchan->type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE ) +if (pchan->chan.type ==ACPI_PCCT_TYPE_EXT_PCC_SLAVE_SUBSPACE )pcc_send_data (chan,NULL ); pchan->chan_in_use = false;
@@ -766,7 +764,7 @@ static int pcc_mbox_probe(struct platform_device *pdev)pcc_parse_subspace_shmem (pchan, pcct_entry); - pchan->type = pcct_entry->type; + pchan->chan.type = pcct_entry->type; pcct_entry = (struct acpi_subtable_header *) ((unsigned long ) pcct_entry + pcct_entry->length); }
include/acpi/pcc.h +1 -0
@@ -16,6 +16,7 @@ struct pcc_mbox_chan {u32 latency;u32 max_access_rate;u16 min_turnaround_time; +u8 type; };#define MAX_PCC_SUBSPACES 256
Signature · 1 line
2.33.0
Huisong Li
maintainerPATCH v2 2/2 soc: kunpeng_hccs: add the check for PCC subspace type
In reply to Huisong LiCurrently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.
--- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/soc/hisilicon/kunpeng_hccs.c +17 -0
@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)return rc; } +static int hccs_check_pcc_info (struct hccs_dev *hdev) +{ +struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; + +if (pcc_chan->type >=ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE ) { +dev_err (hdev->dev,"unsupport for subspace type%u.\n" , + pcc_chan->type); +return -EOPNOTSUPP ; + } + +return 0 ; +} +static int hccs_check_chan_cmd_complete (struct hccs_dev *hdev) {struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
@@ -1224,6 +1237,10 @@ static int hccs_probe(struct platform_device *pdev)if (rc)return rc; + rc =hccs_check_pcc_info (hdev); +if (rc) + goto unregister_pcc_chan; + rc =hccs_get_dev_caps (hdev);if (rc) goto unregister_pcc_chan;
Signature · 1 line
2.33.0
Re: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type
Quoted 17 lines · Huisong Li
Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.Signed-off-by Huisong Li <[email protected]>--- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/soc/hisilicon/kunpeng_hccs.c +0
-0@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)return rc; }
drivers/soc/hisilicon/kunpeng_hccs.c static int hccs_register_pcc_channel(struct hccs_dev *hdev) · line 185
Quoted 10 lines
drivers/soc/hisilicon/kunpeng_hccs.c +9
-0+static int hccs_check_pcc_info (struct hccs_dev *hdev) +{ +struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; + +if (pcc_chan->type >=ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE ) { +dev_err (hdev->dev,"unsupport for subspace type%u.\n" , + pcc_chan->type); +return -EOPNOTSUPP ; + }
Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation.
Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here.
Ideally I would expect the driver to make this transparent and give error during transmit if not supported.
The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the use of Type 4 ? I think we must do something better but I don't know what that is yet.
Signature · 2 lines
Regards, Sudeep
lihuisong (C)
maintainerRe: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type
Quoted 19 lines · Sudeep Holla
Quoted 18 lines · Huisong Li
Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.Signed-off-by Huisong Li <[email protected]>--- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/soc/hisilicon/kunpeng_hccs.c +0
-0@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)return rc; }
Quoted 12 lines
drivers/soc/hisilicon/kunpeng_hccs.c static int hccs_register_pcc_channel(struct hccs_dev *hdev) · line 185
Quoted 9 lines
drivers/soc/hisilicon/kunpeng_hccs.c +9
-0+static int hccs_check_pcc_info (struct hccs_dev *hdev) +{ +struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan; + +if (pcc_chan->type >=ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE ) { +dev_err (hdev->dev,"unsupport for subspace type%u.\n" , + pcc_chan->type); +return -EOPNOTSUPP ; + }Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation.
Yeah, it is just validation now. we want to plan this driver can support more types.
Quoted 3 lines
Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here.
If export PCC type, it is good for the user of PCC to be more universal and more compatible.
Quoted 3 lines
Ideally I would expect the driver to make this transparent and give error during transmit if not supported.
I understand you.
I just check this type only once during the initializing phase. Otherwise, every once need to verify it when send PCC command.
Quoted 3 lines
The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the
Agree more with you.
IMO, the user of PCC has the ability to support variety of platforms if they can get PCC type. In this case, to prevent type 4 is necessary if driver cannot act as a slave.
on the other hand, If one driver acts as a slave, platform must supply slave subspace for them.
Quoted 2 lines
use of Type 4 ? I think we must do something better but I don't know what that is yet.
Yes, we can try to do it better. I have a concern, like below.
You know that the use of PCC can use polling mode and interrupt mode to communicate with platform.
I'm not sure if the obtaining of the polling mode and interrupt mode is an issue to prevent driver to be more universal. But this driver can know if they support interrupt mode based on struct mbox_chan::struct mbox_controller::txdone_irq after requesting PCC channel. Because I'm not sure it's a better way.
You know that drivers used interrupt mode need to fill the rx_callback function into mbx_client when register PCC channel. And drivers used polling mode don't do it.
If we use this way, drivers that both support the two mode have to modify the rx_callback pointer after requesting PCC channel.
Quoted 1 line
lihuisong (C)
maintainerRe: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type
Hi Sudeep,
Quoted 57 lines · lihuisong (C)
Quoted 22 lines · Sudeep Holla
Quoted 21 lines · Huisong Li
Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.Signed-off-by Huisong Li <[email protected]>---
drivers/soc/hisilicon/kunpeng_hccs.c| 17 +++++++++++++++++1 file changed, 17 insertions(+)drivers/soc/hisilicon/kunpeng_hccs.c +2
-0@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev) return rc; } +static int hccs_check_pcc_info(struct hccs_dev *hdev) +{ + struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan;Quoted 8 lines
drivers/soc/hisilicon/kunpeng_hccs.c static int hccs_register_pcc_channel(struct hccs_dev *hdev) · line 185
Quoted 6 lines
drivers/soc/hisilicon/kunpeng_hccs.c +6
-0+ + if (pcc_chan->type >= ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE) { + dev_err(hdev->dev, "unsupport for subspace type%u.\n", + pcc_chan->type); + return -EOPNOTSUPP; + }Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation.
Yeah, it is just validation now. we want to plan this driver can support more types.
Quoted 3 lines
Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here.
If export PCC type, it is good for the user of PCC to be more universal and more compatible.
Quoted 3 lines
Ideally I would expect the driver to make this transparent and give error during transmit if not supported.
I understand you.
I just check this type only once during the initializing phase. Otherwise, every once need to verify it when send PCC command.Quoted 3 lines
The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the
Agree more with you.
IMO, the user of PCC has the ability to support variety of platforms if they can get PCC type. In this case, to prevent type 4 is necessary if driver cannot act as a slave.
on the other hand, If one driver acts as a slave, platform must supply slave subspace for them.Quoted 2 lines
use of Type 4 ? I think we must do something better but I don't know what that is yet.
Yes, we can try to do it better. I have a concern, like below.
Quoted 7 lines
You know that the use of PCC can use polling mode and interrupt mode to communicate with platform.
I'm not sure if the obtaining of the polling mode and interrupt mode is an issue to prevent driver to be more universal. But this driver can know if they support interrupt mode based on structmbox_chan::structmbox_controller::txdone_irqafter requesting PCC channel. Because I'm not sure it's a better way.
You know that drivers used interrupt mode need to fill therx_callbackfunction intombx_clientwhen register PCC channel. And drivers used polling mode don't do it.
If we use this way, drivers that both support the two mode have to modify therx_callbackpointer after requesting PCC channel.
What do you feeling about the comments montioned above?
Maybe we still need to export the information whether the platform support interrupt before requesting PCC channel. Looking forward your reply.
Quoted 2 lines
Quoted 1 line
.
Re: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type
In reply to lihuisong (C)Quoted 31 lines · lihuisong (C)
Quoted 21 lines · Sudeep Holla
Quoted 20 lines · Huisong Li
Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.Signed-off-by Huisong Li <[email protected]>--- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/soc/hisilicon/kunpeng_hccs.c +3
-0@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)return rc; } +static int hccs_check_pcc_info (struct hccs_dev *hdev) +{ +struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan;Quoted 8 lines
drivers/soc/hisilicon/kunpeng_hccs.c static int hccs_register_pcc_channel(struct hccs_dev *hdev) · line 185
Quoted 6 lines
drivers/soc/hisilicon/kunpeng_hccs.c +6
-0+ +if (pcc_chan->type >=ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE ) { +dev_err (hdev->dev,"unsupport for subspace type%u.\n" , + pcc_chan->type); +return -EOPNOTSUPP ; + }Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation.
Quoted 2 lines
Yeah, it is just validation now. we want to plan this driver can support more types.
OK
Quoted 7 lines
Quoted 3 lines
Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here.
If export PCC type, it is good for the user of PCC to be more universal and more compatible.
I don't think it is a good idea to just export raw ACPI PCC type to the client drivers. What if the driver in the future needs to work on a DT platform as well and need to work with non-PCC mailbox channel ?
Also pushing the client PCC drivers to have more ACPI knowledge to understand what each type means is also something I prefer to avoid. The real information you want is whether this is an initiator(previously known master) channel or responder(previously known as slave) channel. It boils down to unidirectional vs bidirectional and what direction in bidirectional channels.
It would be good if mbox framework can be taught that, or atleast make an attempt to see what people think about it. Just patching it the way you are proposing is just going to hide real issue here.
Quoted 6 lines
Quoted 3 lines
Ideally I would expect the driver to make this transparent and give error during transmit if not supported.
I understand you.
I just check this type only once during the initializing phase. Otherwise, every once need to verify it when send PCC command.
Agreed, but refer above for my concern on the solution proposed.
Quoted 10 lines
Quoted 3 lines
The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the
Agree more with you.
IMO, the user of PCC has the ability to support variety of platforms if they can get PCC type.
In this case, to prevent type 4 is necessary if driver cannot act as a slave.
on the other hand, If one driver acts as a slave, platform must supply slave subspace for them.
Quoted 5 lines
Quoted 2 lines
use of Type 4 ? I think we must do something better but I don't know what that is yet.
Yes, we can try to do it better. I have a concern, like below.
Thanks for agreeing.
Quoted 4 lines
You know that the use of PCC can use polling mode and interrupt mode to communicate with platform.
I'm not sure if the obtaining of the polling mode and interrupt mode is an issue to prevent driver to be more universal.
Again this must be addressed at mailbox API level.
Quoted 2 lines
But this driver can know if they support interrupt mode based on struct
mbox_chan::structmbox_controller::txdone_irqafter requesting PCC channel.
Agreed, I was about to ask the same.
Quoted 1 line
Because I'm not sure it's a better way.
Again agreed.
Quoted 5 lines
You know that drivers used interrupt mode need to fill the
rx_callbackfunction intombx_clientwhen register PCC channel.
And drivers used polling mode don't do it.
If we use this way, drivers that both support the two mode have to modify therx_callbackpointer after requesting PCC channel.
I am not sure if I followed all the details here. May be a rough hack helps to understand what you are proposing ? Ofcourse not for merging, just to understand the issue better.
--
Regards,
Sudeep
lihuisong (C)
maintainerRe: [PATCH v2 2/2] soc: kunpeng_hccs: add the check for PCC subspace type
Quoted 33 lines · Sudeep Holla
Quoted 30 lines · lihuisong (C)
Quoted 21 lines · Sudeep Holla
Quoted 20 lines · Huisong Li
Currently, HCCS driver directly uses Generic Communications Channel Shared Memory Region which is used in type0/1/2 to communicate with platform, but actually doesn't support type3/4/5.
So this patch adds the check for PCC subspace type.Signed-off-by Huisong Li <[email protected]>--- drivers/soc/hisilicon/kunpeng_hccs.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)drivers/soc/hisilicon/kunpeng_hccs.c +3
-0@@ -174,6 +174,19 @@ static int hccs_register_pcc_channel(struct hccs_dev *hdev)return rc; } +static int hccs_check_pcc_info (struct hccs_dev *hdev) +{ +struct pcc_mbox_chan *pcc_chan = hdev->cl_info.pcc_chan;Quoted 8 lines
drivers/soc/hisilicon/kunpeng_hccs.c static int hccs_register_pcc_channel(struct hccs_dev *hdev) · line 185
Quoted 6 lines
drivers/soc/hisilicon/kunpeng_hccs.c +6
-0+ +if (pcc_chan->type >=ACPI_PCCT_TYPE_EXT_PCC_MASTER_SUBSPACE ) { +dev_err (hdev->dev,"unsupport for subspace type%u.\n" , + pcc_chan->type); +return -EOPNOTSUPP ; + }Is this the only use of the PCC type information you have or do you plan to use it for something other than the validation.
Quoted 2 lines
Yeah, it is just validation now. we want to plan this driver can support more types.
Quoted 8 lines
OK
Quoted 5 lines
Quoted 2 lines
Just for sake of argument, I can say all users of PCC must then do the similar validation. I don't know where to draw the line here.
If export PCC type, it is good for the user of PCC to be more universal and more compatible.
I don't think it is a good idea to just export raw ACPI PCC type to the
I understand you.
But the format and size of type0-2, type3/4 and type5 are different.
And all PCC client drivers need to know which PCC type they used and how to fill
the shared memory region header.
Please notice that the type used by the client driver is fixed and agreed with the platform in advance.
Quoted 2 lines
client drivers. What if the driver in the future needs to work on a DT platform as well and need to work with non-PCC mailbox channel ?
It's also an alternative path.
Quoted 3 lines
Also pushing the client PCC drivers to have more ACPI knowledge to understand what each type means is also something I prefer to avoid. The real information
Yeah, it is great that the PCC client drivers don't need to know which PCC type is used. But it is inevitable according to above mentioned.
Quoted 3 lines
you want is whether this is an initiator(previously known master) channel or responder(previously known as slave) channel. It boils down to unidirectional vs bidirectional and what direction in bidirectional channels.
not just for this.
Quoted 25 lines
It would be good if mbox framework can be taught that, or atleast make an attempt to see what people think about it. Just patching it the way you are proposing is just going to hide real issue here.
Quoted 5 lines
Quoted 2 lines
Ideally I would expect the driver to make this transparent and give error during transmit if not supported.
I understand you.
I just check this type only once during the initializing phase. Otherwise, every once need to verify it when send PCC command.Agreed, but refer above for my concern on the solution proposed.
Quoted 9 lines
Quoted 2 lines
The driver must be able to work with different PCC type to support variety of platforms TBH. What is the issue exactly here ? Is this to prevent the
Agree more with you.
IMO, the user of PCC has the ability to support variety of platforms if they can get PCC type.
In this case, to prevent type 4 is necessary if driver cannot act as a slave.
on the other hand, If one driver acts as a slave, platform must supply slave subspace for them.Quoted 4 lines
Quoted 2 lines
use of Type 4 ? I think we must do something better but I don't know what that is yet.
Yes, we can try to do it better. I have a concern, like below.
Quoted 7 lines
Thanks for agreeing.
Quoted 4 lines
You know that the use of PCC can use polling mode and interrupt mode to communicate with platform.
I'm not sure if the obtaining of the polling mode and interrupt mode is an issue to prevent driver to be more universal.Again this must be addressed at mailbox API level.
Maybe it is ok.
The harder thing to deal with is that the client driver needs to decide if set rx_callback for the polling or interrupt mode before requesting PCC channel.
because driver doesn't know whether platform supports interrupt.
If we fully put PCC type and interrupt mode we discussed to mailbox API or PCC driver, there are possibly many works should be done. I have no good idea to do it yet.
Quoted 8 lines
Quoted 3 lines
But this driver can know if they support interrupt mode based on struct
mbox_chan::structmbox_controller::txdone_irqafter requesting PCC channel.Agreed, I was about to ask the same.
Quoted 1 line
Because I'm not sure it's a better way.
Again agreed.
Quoted 8 lines
Quoted 5 lines
You know that drivers used interrupt mode need to fill the
rx_callbackfunction intombx_clientwhen register PCC channel.
And drivers used polling mode don't do it.
If we use this way, drivers that both support the two mode have to modify therx_callbackpointer after requesting PCC channel.I am not sure if I followed all the details here. May be a rough hack helps to understand what you are proposing ? Ofcourse not for merging, just to understand the issue better.
please see the above reply😁
Quoted 6 lines
--
Regards,
Sudeep.