diff mbox series

[09/13] u2f-passthru: put it into the 'usb' category

Message ID 20201115184903.1292715-10-ganqixin@huawei.com (mailing list archive)
State New, archived
Headers show
Series Categorize some uncategorized devices | expand

Commit Message

Gan Qixin Nov. 15, 2020, 6:48 p.m. UTC
The category of the u2f-passthru device is not set, put it into the 'usb'
category.

Signed-off-by: Gan Qixin <ganqixin@huawei.com>
---
Cc: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/usb/u2f-passthru.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Philippe Mathieu-Daudé Nov. 16, 2020, 2:04 p.m. UTC | #1
On 11/15/20 7:48 PM, Gan Qixin wrote:
> The category of the u2f-passthru device is not set, put it into the 'usb'
> category.

I guess we discussed this with Thomas 1 or 2 years ago
but I don't remember. I think it was about using set_bits()
so devices can appear in multiple categories.

Gerd, do you know what is the point of the "usb" category for
management apps? This is a bus accepting multiple better
categorized devices (display, storage, input, network, sound).

Unrelated but multiple devices are related to SECURITY.
Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?

> 
> Signed-off-by: Gan Qixin <ganqixin@huawei.com>
> ---
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/usb/u2f-passthru.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c
> index ae00e93f35..000822f396 100644
> --- a/hw/usb/u2f-passthru.c
> +++ b/hw/usb/u2f-passthru.c
> @@ -534,6 +534,7 @@ static void u2f_passthru_class_init(ObjectClass *klass, void *data)
>      dc->desc = "QEMU U2F passthrough key";
>      dc->vmsd = &u2f_passthru_vmstate;
>      device_class_set_props(dc, u2f_passthru_properties);
> +    set_bit(DEVICE_CATEGORY_USB, dc->categories);
>  }
>  
>  static const TypeInfo u2f_key_passthru_info = {
>
Gerd Hoffmann Nov. 17, 2020, 6:58 a.m. UTC | #2
On Mon, Nov 16, 2020 at 03:04:52PM +0100, Philippe Mathieu-Daudé wrote:
> On 11/15/20 7:48 PM, Gan Qixin wrote:
> > The category of the u2f-passthru device is not set, put it into the 'usb'
> > category.
> 
> I guess we discussed this with Thomas 1 or 2 years ago
> but I don't remember. I think it was about using set_bits()
> so devices can appear in multiple categories.
> 
> Gerd, do you know what is the point of the "usb" category for
> management apps? This is a bus accepting multiple better
> categorized devices (display, storage, input, network, sound).

Right now we have the host adapters collected in the usb category.
Maybe we should rename the category to make that clear.

And, yes, tagging the u2f devices as "usb" doesn't look useful.

> Unrelated but multiple devices are related to SECURITY.
> Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?

Either that, or place it in the "misc" category.

take care,
  Gerd
Gan Qixin Nov. 17, 2020, 1:37 p.m. UTC | #3
> -----Original Message-----
> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> Sent: Monday, November 16, 2020 10:05 PM
> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
> qemu-trivial@nongnu.org; Marc-André Lureau
> <marcandre.lureau@redhat.com>; thuth@redhat.com
> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann <kraxel@redhat.com>;
> Eduardo Habkost <ehabkost@redhat.com>
> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb' category
> 
> On 11/15/20 7:48 PM, Gan Qixin wrote:
> > The category of the u2f-passthru device is not set, put it into the 'usb'
> > category.
> 
> I guess we discussed this with Thomas 1 or 2 years ago but I don't remember.
> I think it was about using set_bits() so devices can appear in multiple
> categories.
> 
> Gerd, do you know what is the point of the "usb" category for management
> apps? This is a bus accepting multiple better categorized devices (display,
> storage, input, network, sound).
> 
> Unrelated but multiple devices are related to SECURITY.
> Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?

Hi, Philippe
Thanks for your reply, but I'm not sure if it is appropriate to add a security category to place this device.
(Maybe it's because I don't know much about these device, I haven't find many safety-related devices in 'misc' category or uncategorized devices)

Thanks,
Gan Qixin
Gan Qixin Nov. 17, 2020, 1:40 p.m. UTC | #4
> -----Original Message-----
> From: Gerd Hoffmann [mailto:kraxel@redhat.com]
> Sent: Tuesday, November 17, 2020 2:59 PM
> To: Philippe Mathieu-Daudé <philmd@redhat.com>
> Cc: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
> qemu-trivial@nongnu.org; Marc-André Lureau
> <marcandre.lureau@redhat.com>; thuth@redhat.com; Chenqun (kuhn)
> <kuhn.chenqun@huawei.com>; Zhanghailiang
> <zhang.zhanghailiang@huawei.com>; Eduardo Habkost
> <ehabkost@redhat.com>
> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb' category
> 
> On Mon, Nov 16, 2020 at 03:04:52PM +0100, Philippe Mathieu-Daudé
> wrote:
> > On 11/15/20 7:48 PM, Gan Qixin wrote:
> > > The category of the u2f-passthru device is not set, put it into the 'usb'
> > > category.
> >
> > I guess we discussed this with Thomas 1 or 2 years ago but I don't
> > remember. I think it was about using set_bits() so devices can appear
> > in multiple categories.
> >
> > Gerd, do you know what is the point of the "usb" category for
> > management apps? This is a bus accepting multiple better categorized
> > devices (display, storage, input, network, sound).
> 
> Right now we have the host adapters collected in the usb category.
> Maybe we should rename the category to make that clear.
> 
> And, yes, tagging the u2f devices as "usb" doesn't look useful.
> 
> > Unrelated but multiple devices are related to SECURITY.
> > Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?
> 
> Either that, or place it in the "misc" category.

Thanks for your advice, I will put it into 'misc' category.

Gan Qixin
Philippe Mathieu-Daudé Dec. 4, 2020, 1:50 p.m. UTC | #5
On 11/17/20 2:37 PM, ganqixin wrote:
>> -----Original Message-----
>> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
>> Sent: Monday, November 16, 2020 10:05 PM
>> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
>> qemu-trivial@nongnu.org; Marc-André Lureau
>> <marcandre.lureau@redhat.com>; thuth@redhat.com
>> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
>> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann <kraxel@redhat.com>;
>> Eduardo Habkost <ehabkost@redhat.com>
>> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb' category
>>
>> On 11/15/20 7:48 PM, Gan Qixin wrote:
>>> The category of the u2f-passthru device is not set, put it into the 'usb'
>>> category.
>>
>> I guess we discussed this with Thomas 1 or 2 years ago but I don't remember.
>> I think it was about using set_bits() so devices can appear in multiple
>> categories.
>>
>> Gerd, do you know what is the point of the "usb" category for management
>> apps? This is a bus accepting multiple better categorized devices (display,
>> storage, input, network, sound).
>>
>> Unrelated but multiple devices are related to SECURITY.
>> Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?
> 
> Hi, Philippe
> Thanks for your reply, but I'm not sure if it is appropriate to add a security category to place this device.
> (Maybe it's because I don't know much about these device, I haven't find many safety-related devices in 'misc' category or uncategorized devices)

What is the difference between 'misc' and 'uncategorized'?

> 
> Thanks,
> Gan Qixin
>
Gan Qixin Dec. 7, 2020, 8:05 a.m. UTC | #6
> -----Original Message-----
> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> Sent: Friday, December 4, 2020 9:50 PM
> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
> qemu-trivial@nongnu.org
> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann
> <kraxel@redhat.com>; thuth@redhat.com
> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb' category
> 
> On 11/17/20 2:37 PM, ganqixin wrote:
> >> -----Original Message-----
> >> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
> >> Sent: Monday, November 16, 2020 10:05 PM
> >> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
> >> qemu-trivial@nongnu.org; Marc-André Lureau
> >> <marcandre.lureau@redhat.com>; thuth@redhat.com
> >> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
> >> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann
> <kraxel@redhat.com>;
> >> Eduardo Habkost <ehabkost@redhat.com>
> >> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb'
> >> category
> >>
> >> On 11/15/20 7:48 PM, Gan Qixin wrote:
> >>> The category of the u2f-passthru device is not set, put it into the 'usb'
> >>> category.
> >>
> >> I guess we discussed this with Thomas 1 or 2 years ago but I don't
> remember.
> >> I think it was about using set_bits() so devices can appear in
> >> multiple categories.
> >>
> >> Gerd, do you know what is the point of the "usb" category for
> >> management apps? This is a bus accepting multiple better categorized
> >> devices (display, storage, input, network, sound).
> >>
> >> Unrelated but multiple devices are related to SECURITY.
> >> Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?
> >
> > Hi, Philippe
> > Thanks for your reply, but I'm not sure if it is appropriate to add a
> security category to place this device.
> > (Maybe it's because I don't know much about these device, I haven't
> > find many safety-related devices in 'misc' category or uncategorized
> > devices)
> 
> What is the difference between 'misc' and 'uncategorized'?

In my opinion, devices that we forgot to classify will appear in "uncategorized" list, and devices that don't have a suitable category to choose will be put into "misc" category.

> 
> >
> > Thanks,
> > Gan Qixin
> >
Thomas Huth Dec. 7, 2020, 8:52 a.m. UTC | #7
On 07/12/2020 09.05, ganqixin wrote:
>> -----Original Message-----
>> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
>> Sent: Friday, December 4, 2020 9:50 PM
>> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
>> qemu-trivial@nongnu.org
>> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
>> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann
>> <kraxel@redhat.com>; thuth@redhat.com
>> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb' category
>>
>> On 11/17/20 2:37 PM, ganqixin wrote:
>>>> -----Original Message-----
>>>> From: Philippe Mathieu-Daudé [mailto:philmd@redhat.com]
>>>> Sent: Monday, November 16, 2020 10:05 PM
>>>> To: ganqixin <ganqixin@huawei.com>; qemu-devel@nongnu.org;
>>>> qemu-trivial@nongnu.org; Marc-André Lureau
>>>> <marcandre.lureau@redhat.com>; thuth@redhat.com
>>>> Cc: Chenqun (kuhn) <kuhn.chenqun@huawei.com>; Zhanghailiang
>>>> <zhang.zhanghailiang@huawei.com>; Gerd Hoffmann
>> <kraxel@redhat.com>;
>>>> Eduardo Habkost <ehabkost@redhat.com>
>>>> Subject: Re: [PATCH 09/13] u2f-passthru: put it into the 'usb'
>>>> category
>>>>
>>>> On 11/15/20 7:48 PM, Gan Qixin wrote:
>>>>> The category of the u2f-passthru device is not set, put it into the 'usb'
>>>>> category.
>>>>
>>>> I guess we discussed this with Thomas 1 or 2 years ago but I don't
>> remember.
>>>> I think it was about using set_bits() so devices can appear in
>>>> multiple categories.
>>>>
>>>> Gerd, do you know what is the point of the "usb" category for
>>>> management apps? This is a bus accepting multiple better categorized
>>>> devices (display, storage, input, network, sound).
>>>>
>>>> Unrelated but multiple devices are related to SECURITY.
>>>> Maybe it is time to introduce the DEVICE_CATEGORY_SECURITY?
>>>
>>> Hi, Philippe
>>> Thanks for your reply, but I'm not sure if it is appropriate to add a
>> security category to place this device.
>>> (Maybe it's because I don't know much about these device, I haven't
>>> find many safety-related devices in 'misc' category or uncategorized
>>> devices)
>>
>> What is the difference between 'misc' and 'uncategorized'?
> 
> In my opinion, devices that we forgot to classify will appear in "uncategorized" list, and devices that don't have a suitable category to choose will be put into "misc" category.

That's right. User-creatable devices should have a category, and the
uncategorized devices just have not been categorized yet.

So thanks for tackling this, Gan Qixin!

 Thomas
diff mbox series

Patch

diff --git a/hw/usb/u2f-passthru.c b/hw/usb/u2f-passthru.c
index ae00e93f35..000822f396 100644
--- a/hw/usb/u2f-passthru.c
+++ b/hw/usb/u2f-passthru.c
@@ -534,6 +534,7 @@  static void u2f_passthru_class_init(ObjectClass *klass, void *data)
     dc->desc = "QEMU U2F passthrough key";
     dc->vmsd = &u2f_passthru_vmstate;
     device_class_set_props(dc, u2f_passthru_properties);
+    set_bit(DEVICE_CATEGORY_USB, dc->categories);
 }
 
 static const TypeInfo u2f_key_passthru_info = {