Skip to contentSkip to conversation

hw/usb: add configuration flags for emulated and passthru usb smartcard

PATCH In review Jon Maloy 3 participants 6 messages Dec 12, 2022 – Jan 19, 2023 Arm/Amlogic Meson SoC support

lore
Share & tools
lore

Jon Maloy

author
#0 lore raw

v3 cover hw/usb: add configuration flags for emulated and passthru usb smartcard

We add three new configuration flags, LIBCACARD, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these functionalities.

---
v2: Added a LIBACARD flag, plus reversed 'select' clauses, as suggested
by Paolo Bonzini and Marc-André Lureau.

v3: Split in two commits, so that LIBCACARD is added separately, as suggested
by Philippe Mathieu-Daudé.

Jon Maloy (2):
hw/usb: add configuration flags for emulated and passthru usb
smartcard
hw/usb: add configuration flag for Common Access Card library code

 Kconfig.host       |  3 +++
 hw/usb/Kconfig     | 14 ++++++++++++++
 hw/usb/meson.build | 11 ++++-------
 meson.build        |  1 +
 4 files changed, 22 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3
author
#1 lore raw

PATCH v3 1/2 hw/usb: add configuration flags for emulated and passthru usb smartcard

We add two new configuration flags, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these functionalities.

---
 hw/usb/Kconfig     | 12 ++++++++++++
 hw/usb/meson.build |  4 ++--
 2 files changed, 14 insertions(+), 2 deletions(-)
hw/usb/Kconfig +12 -0
index ce4f433976..6b29e91593 100644
@@ -109,6 +109,18 @@ config USB_SMARTCARD
     default y
     depends on USB
 
+config USB_SMARTCARD_PASSTHRU
+    bool
+    default y
+    depends on USB
+    select USB_SMARTCARD
+
+config USB_SMARTCARD_EMULATED
+    bool
+    default y
+    depends on USB
+    select USB_SMARTCARD
+
 config USB_STORAGE_MTP
     bool
     default y
hw/usb/meson.build +2 -2
index 793df42e21..353006fb6c 100644
@@ -51,8 +51,8 @@ softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reade
 
 if cacard.found()
   usbsmartcard_ss = ss.source_set()
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD',
-                      if_true: [cacard, files('ccid-card-emulated.c', 'ccid-card-passthru.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true: [cacard, files('ccid-card-emulated.c')])
+  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true: [cacard, files('ccid-card-passthru.c')])
   hw_usb_modules += {'smartcard': usbsmartcard_ss}
 endif
 
Signature · 1 line
2.35.3
author
#2 lore raw

PATCH v3 2/2 hw/usb: add configuration flag for Common Access Card library code

In reply to Jon Maloy

We add a new configuration flag, LIBCACARD, indicating availability of the libcacard code for building. This way, we can eliminate the explicit test for cacard.found() when configuring USB_SMARTCARD_EMULATED/USB_SMARTCARD_PASSTHRU in hw/usb/meson.build.

---
 Kconfig.host       |  3 +++
 hw/usb/Kconfig     |  2 ++
 hw/usb/meson.build | 11 ++++-------
 meson.build        |  1 +
 4 files changed, 10 insertions(+), 7 deletions(-)
Kconfig.host +3 -0
index d763d89269..d7fd4a2203 100644
@@ -39,6 +39,9 @@ config MULTIPROCESS_ALLOWED
     bool
     imply MULTIPROCESS
 
+config LIBCACARD
+    bool
+
 config FUZZ
     bool
     select SPARSE_MEM
hw/usb/Kconfig +2 -0
index 6b29e91593..5c3da7c34d 100644
@@ -113,12 +113,14 @@ config USB_SMARTCARD_PASSTHRU
     bool
     default y
     depends on USB
+    depends on LIBCACARD
     select USB_SMARTCARD
 
 config USB_SMARTCARD_EMULATED
     bool
     default y
     depends on USB
+    depends on LIBCACARD
     select USB_SMARTCARD
 
 config USB_STORAGE_MTP
hw/usb/meson.build +4 -7
index 353006fb6c..499be1122c 100644
@@ -48,13 +48,10 @@ softmmu_ss.add(when: ['CONFIG_POSIX', 'CONFIG_USB_STORAGE_MTP'], if_true: files(
 
 # smartcard
 softmmu_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader.c'))
-
-if cacard.found()
-  usbsmartcard_ss = ss.source_set()
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true: [cacard, files('ccid-card-emulated.c')])
-  usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true: [cacard, files('ccid-card-passthru.c')])
-  hw_usb_modules += {'smartcard': usbsmartcard_ss}
-endif
+usbsmartcard_ss = ss.source_set()
+usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_EMULATED', if_true: [cacard, files('ccid-card-emulated.c')])
+usbsmartcard_ss.add(when: 'CONFIG_USB_SMARTCARD_PASSTHRU', if_true: [cacard, files('ccid-card-passthru.c')])
+hw_usb_modules += {'smartcard': usbsmartcard_ss}
 
 # U2F
 softmmu_ss.add(when: 'CONFIG_USB_U2F', if_true: files('u2f.c'))
meson.build +1 -0
index 5c6b5a1c75..10e9b77ec1 100644
@@ -2493,6 +2493,7 @@ have_ivshmem = config_host_data.get('CONFIG_EVENTFD')
 host_kconfig = \
   (get_option('fuzzing') ? ['CONFIG_FUZZ=y'] : []) + \
   (have_tpm ? ['CONFIG_TPM=y'] : []) + \
+  (cacard.found() ? ['CONFIG_LIBCACARD=y'] : []) + \
   (spice.found() ? ['CONFIG_SPICE=y'] : []) + \
   (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
   (opengl.found() ? ['CONFIG_OPENGL=y'] : []) + \
Signature · 1 line
2.35.3
Reviewed-by on the v3 series
#3 lore raw
In reply to Jon Maloy
Quoted 8 lines · Jon Maloy

We add three new configuration flags, LIBCACARD, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these functionalities.

Jon Maloy (2):
hw/usb: add configuration flags for emulated and passthru usb
smartcard
hw/usb: add configuration flag for Common Access Card library code

Series:

Reviewed-by on the v3 series
#4 lore raw
In reply to Jon Maloy
Quoted 19 lines · Jon Maloy

We add three new configuration flags, LIBCACARD, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these functionalities.

---
v2: Added a LIBACARD flag, plus reversed 'select' clauses, as suggested
by Paolo Bonzini and Marc-André Lureau.

v3: Split in two commits, so that LIBCACARD is added separately, as suggested
by Philippe Mathieu-Daudé.

Jon Maloy (2):
hw/usb: add configuration flags for emulated and passthru usb
smartcard
hw/usb: add configuration flag for Common Access Card library code

Quoted 9 lines
 Kconfig.host       |  3 +++
 hw/usb/Kconfig     | 14 ++++++++++++++
 hw/usb/meson.build | 11 ++++-------
 meson.build        |  1 +
 4 files changed, 22 insertions(+), 7 deletions(-)
Signature · 1 line
2.35.3

I have CCed Gerd Hoffmann since he is the hw/usb/ maintainer.

author
#5 lore raw
Quoted 26 lines · Stefan Hajnoczi
Quoted 25 lines · Jon Maloy

We add three new configuration flags, LIBCACARD, USB_SMARTCARD_PASSTHRU and USB_SMARTCARD_EMULATED in order to improve configurability of these functionalities.

---
v2: Added a LIBACARD flag, plus reversed 'select' clauses, as suggested
by Paolo Bonzini and Marc-André Lureau.

v3: Split in two commits, so that LIBCACARD is added separately, as suggested
by Philippe Mathieu-Daudé.

Jon Maloy (2):
hw/usb: add configuration flags for emulated and passthru usb
smartcard
hw/usb: add configuration flag for Common Access Card library code

  Kconfig.host       |  3 +++
  hw/usb/Kconfig     | 14 ++++++++++++++
  hw/usb/meson.build | 11 ++++-------
  meson.build        |  1 +
  4 files changed, 22 insertions(+), 7 deletions(-)
Quoted 6 lines
Quoted 3 lines
Signature · 1 line
2.35.3

I have CCed Gerd Hoffmann since he is the hw/usb/ maintainer.

Hi Gerd,
It seems this one was forgotten, and never applied. Could you have a look?

Thanks
///jon