mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 20:51:03 +02:00
thunderbolt: Allow disabling XDomain protocol
This allows disabling XDomain protocol completely if the user does not plan to use the USB4/Thunderbolt peer-to-peer functionality, or for security reasons. XDomain protocol is enabled by default but with this commit it is possible to disable it by passing "xdomain=0" as module parameter (or through the kernel command line). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com>
This commit is contained in:
@@ -412,7 +412,9 @@ static bool tb_domain_event_cb(void *data, enum tb_cfg_pkg_type type,
|
|||||||
switch (type) {
|
switch (type) {
|
||||||
case TB_CFG_PKG_XDOMAIN_REQ:
|
case TB_CFG_PKG_XDOMAIN_REQ:
|
||||||
case TB_CFG_PKG_XDOMAIN_RESP:
|
case TB_CFG_PKG_XDOMAIN_RESP:
|
||||||
|
if (tb_is_xdomain_enabled())
|
||||||
return tb_xdomain_handle_request(tb, type, buf, size);
|
return tb_xdomain_handle_request(tb, type, buf, size);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
tb->cm_ops->handle_event(tb, type, buf, size);
|
tb->cm_ops->handle_event(tb, type, buf, size);
|
||||||
|
@@ -1701,9 +1701,11 @@ static void icm_handle_notification(struct work_struct *work)
|
|||||||
icm->device_disconnected(tb, n->pkg);
|
icm->device_disconnected(tb, n->pkg);
|
||||||
break;
|
break;
|
||||||
case ICM_EVENT_XDOMAIN_CONNECTED:
|
case ICM_EVENT_XDOMAIN_CONNECTED:
|
||||||
|
if (tb_is_xdomain_enabled())
|
||||||
icm->xdomain_connected(tb, n->pkg);
|
icm->xdomain_connected(tb, n->pkg);
|
||||||
break;
|
break;
|
||||||
case ICM_EVENT_XDOMAIN_DISCONNECTED:
|
case ICM_EVENT_XDOMAIN_DISCONNECTED:
|
||||||
|
if (tb_is_xdomain_enabled())
|
||||||
icm->xdomain_disconnected(tb, n->pkg);
|
icm->xdomain_disconnected(tb, n->pkg);
|
||||||
break;
|
break;
|
||||||
case ICM_EVENT_RTD3_VETO:
|
case ICM_EVENT_RTD3_VETO:
|
||||||
|
@@ -179,6 +179,9 @@ static void tb_scan_xdomain(struct tb_port *port)
|
|||||||
struct tb_xdomain *xd;
|
struct tb_xdomain *xd;
|
||||||
u64 route;
|
u64 route;
|
||||||
|
|
||||||
|
if (!tb_is_xdomain_enabled())
|
||||||
|
return;
|
||||||
|
|
||||||
route = tb_downstream_route(port);
|
route = tb_downstream_route(port);
|
||||||
xd = tb_xdomain_find_by_route(tb, route);
|
xd = tb_xdomain_find_by_route(tb, route);
|
||||||
if (xd) {
|
if (xd) {
|
||||||
|
@@ -958,6 +958,7 @@ static inline u64 tb_downstream_route(struct tb_port *port)
|
|||||||
| ((u64) port->port << (port->sw->config.depth * 8));
|
| ((u64) port->port << (port->sw->config.depth * 8));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool tb_is_xdomain_enabled(void);
|
||||||
bool tb_xdomain_handle_request(struct tb *tb, enum tb_cfg_pkg_type type,
|
bool tb_xdomain_handle_request(struct tb *tb, enum tb_cfg_pkg_type type,
|
||||||
const void *buf, size_t size);
|
const void *buf, size_t size);
|
||||||
struct tb_xdomain *tb_xdomain_alloc(struct tb *tb, struct device *parent,
|
struct tb_xdomain *tb_xdomain_alloc(struct tb *tb, struct device *parent,
|
||||||
|
@@ -30,6 +30,10 @@ struct xdomain_request_work {
|
|||||||
struct tb *tb;
|
struct tb *tb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool tb_xdomain_enabled = true;
|
||||||
|
module_param_named(xdomain, tb_xdomain_enabled, bool, 0444);
|
||||||
|
MODULE_PARM_DESC(xdomain, "allow XDomain protocol (default: true)");
|
||||||
|
|
||||||
/* Serializes access to the properties and protocol handlers below */
|
/* Serializes access to the properties and protocol handlers below */
|
||||||
static DEFINE_MUTEX(xdomain_lock);
|
static DEFINE_MUTEX(xdomain_lock);
|
||||||
|
|
||||||
@@ -47,6 +51,11 @@ static const uuid_t tb_xdp_uuid =
|
|||||||
UUID_INIT(0xb638d70e, 0x42ff, 0x40bb,
|
UUID_INIT(0xb638d70e, 0x42ff, 0x40bb,
|
||||||
0x97, 0xc2, 0x90, 0xe2, 0xc0, 0xb2, 0xff, 0x07);
|
0x97, 0xc2, 0x90, 0xe2, 0xc0, 0xb2, 0xff, 0x07);
|
||||||
|
|
||||||
|
bool tb_is_xdomain_enabled(void)
|
||||||
|
{
|
||||||
|
return tb_xdomain_enabled;
|
||||||
|
}
|
||||||
|
|
||||||
static bool tb_xdomain_match(const struct tb_cfg_request *req,
|
static bool tb_xdomain_match(const struct tb_cfg_request *req,
|
||||||
const struct ctl_pkg *pkg)
|
const struct ctl_pkg *pkg)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user